Does python have networking? - - An Overclocking Community

Forum Jump: 

Does python have networking?

Thread Tools
post #1 of 8 (permalink) Old 09-05-2015, 08:54 PM - Thread Starter
New to
Higgins909's Avatar
Join Date: Dec 2011
Posts: 242
Rep: 1 (Unique: 1)
I'm trying to learn python from and I'm about half way through.
I've looked at the index or whatever its called (don't know book terms) and it never mentions anything about networking. Only at the end does it say something like move onto ruby..

Does python have networking... Like I could make a game and have people connect over lan/wan?
Does ruby?

Higgins909 is offline  
Sponsored Links
post #2 of 8 (permalink) Old 09-05-2015, 09:04 PM
Retired Staff
Join Date: Nov 2006
Location: NJ
Posts: 65,143
Rep: 4426 (Unique: 2045)
Sure... python has network libraries/modules natively....

Just learning to networked gaming is quite a big jump....

To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it should work (4) Resolution, not screen size (5) Report, not respond to Spam (6) Single-Rail/Non-Modular PSUs are not always better than Multi-Rail/Modular (7) Sequential does not matter as much as random for OS drives (8) Requirements come before hardware for servers

DuckieHo is offline  
post #3 of 8 (permalink) Old 09-10-2015, 06:32 PM - Thread Starter
New to
Higgins909's Avatar
Join Date: Dec 2011
Posts: 242
Rep: 1 (Unique: 1)
... rather confused with the word native attached to libraries. Does that mean I've got to learn another language? as that answer mentions c/c++ and normal dll and libs.
This is a example I was able to find that at least made some sense, but confused me on other parts.

This was in a java area.
"Native Library" generally means a non-Java library that's used by the system (so C/C++, etc). Think normal DLLs or libs.

What about graphics? Would it be called a gui in this case? I know linux has cli and gui versions... in a game is it called a gui still?
Higgins909 is offline  
Sponsored Links
post #4 of 8 (permalink) Old 09-10-2015, 06:58 PM
New to
aldfig0's Avatar
Join Date: Jan 2010
Location: California
Posts: 850
Rep: 69 (Unique: 66)
It means that by virtue of installing Python you've already got the standard library included. All you have to do is type "import socket" in your .py file and you can use everything in the socket module by typing socket. and the function name and arguments after the dot.

If you're clicking at things in your game instead of just typing in commands then your game uses a graphical user interface. If you want to do this note that Python has Tkinter built in its standard library which will easily allow you do create a GUI. You can also use third-party ones like PyQt, wxPython, or PyGame (which should have game-specific features but I've never used it so I can't be too sure).
aldfig0 is offline  
post #5 of 8 (permalink) Old 09-15-2015, 11:26 AM
New to
Mrzev's Avatar
Join Date: Feb 2008
Location: Texas
Posts: 2,258
Rep: 96 (Unique: 76)
Whenever i need to listen to a port for data and do something with it, I tend to go with python because it's pretty quick and easy. This script listens to port 5555 and writes the data into an SQL db.

import socket
import sys
import json
import mysql.connector
from datetime import datetime

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Bind the socket to the port
server_address = ('', 5555)
print >>sys.stderr, 'starting up on %s port %s' % server_address
# Listen for incoming connections

print >>sys.stderr, 'Started - Listening'
while True:
        # Wait for a connection
        message = ""
        connection, client_address = sock.accept()
                print >>sys.stderr, 'connection from', client_address
                while True:
                        #Loops trough 1KB at a time until it received all the data.
                        data = connection.recv(1024)
                        message += data
                        if not data:                            
                                print message
                                print " "
                                jdata = json.loads(message)
                                cnx = mysql.connector.connect(user='', password='',
                                cursor = cnx.cursor()
                                type= jdata["MovementForward"][0]["Device"]["type"]
                                name = jdata["MovementForward"][0]["Device"]["name"]
                                x= jdata["MovementForward"][0]["Device"]["movements"][0]["Movement"]["points"][3]["PointLoc"]["x"]
                                y= jdata["MovementForward"][0]["Device"]["movements"][0]["Movement"]["points"][3]["PointLoc"]["y"]
                                date_object = datetime.strptime(jdata["MovementForward"][0]["Device"]["movements"][0]["Movement"]["date"], '%Y-%m-%dT%H:%M:%S+0000')

                                cursor.execute("INSERT INTO locations (type,name,x,y,dateReceived) VALUES (%s, %s, %s, %s, %s)",(type, name,x,y,date_object))

Mrzev is offline  
post #6 of 8 (permalink) Old 12-09-2018, 11:03 PM
New to
Join Date: Dec 2018
Posts: 1
Rep: 0
Python Networking

Python Networking Programs..
markgeven is offline  
post #7 of 8 (permalink) Old 12-11-2018, 01:47 PM
New to
PhotonFanatic's Avatar
Join Date: Dec 2009
Posts: 1,878
Rep: 19 (Unique: 18)
A bit off topic, but it looks like is just a site that sells a book. Am I missing anything here?

"Executing execution.exe"
Bang for the buck
(12 items)
3570k @ 4.6Ghz @1.35v
Gigabyte Z77x UD3H
evga GTX 970 SSC
16Gb Gskill Ripjaws 2133Mhz @ 9-11-10-28
Hard Drive
Samsung Evo 850
Power Supply
Silverstone 900 watt
Thermalright Ultra 120 Extreme
Silverstone Raven (1st edition)
Operating System
Windows 10 Spy Delux
Xstar 27" PLS 1440p
Wireless ergonomic
Logisys Wireless trackball
▲ hide details ▲
PhotonFanatic is offline  
post #8 of 8 (permalink) Old 08-17-2019, 01:30 PM
New to
Cloudforever's Avatar
Join Date: Sep 2010
Location: Kentucky
Posts: 1,263
Rep: 60 (Unique: 46)
you guys rock. Those links you've provided greatly helps.


Cloudforever is offline  

Quick Reply

Register Now

In order to be able to post messages on the - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Please enter a password for your user account. Note that passwords are case-sensitive.
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off