Hello all. I'm working with pygame and are trying to implement some type of server.

oops! sorry. anyways...

i'm a little fuzzy on all this socket server stuff, so try to bear with me. I want to users to be able to connect to each other. the code for my server is:

import socket

socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.bind(( "", 1024 ))
print "Bind socket to: 1024..."
socket.listen(2) # Listen for connections made to the socket; can support 2, as we specified
conn, addr = socket.accept() # accepts connection

while 1: # infinite while loop
     print 'Running?'
     data = conn.recv(1024)
     if not data:
          break
          conn.send(data)

and for my 'client':

import socket

socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.connect(1024)
os.system("pause")

so how does a server really work? mine doesn't really work when I run it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.