[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Soc: Simple Networking
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Soc: Simple Networking
- From: "Simon Wittber" <simonwittber@xxxxxxxxx>
- Date: Mon, 1 May 2006 10:43:49 +0800
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sun, 30 Apr 2006 22:43:55 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ni67UcbKVCW6fbrT15Pu7QthbJdNPRAG/aAOCbdhb2wh+mLQWYB+PQNTsKNsNxWMgGgPKDGNLcmlZKdcF3Me13cWQlmvJp4uqaL2eVqYxefjavn/wnppJA3pI/3WKf27A1K2XP+3QHuZYJdFl3C+HhMRbptIM9P4GbI5OBrLqJQ=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Some interest has been expressed in completing this:
http://wiki.python.org/moin/SummerOfCode/SimpleNetworkingForPygame
as a Summer of Code project.
We need to define an API to ensure that any work done is usable, and
integrated well into pygame.
Based on the above wiki page, I have come up with the below interface
definition. Please supply some comments and criticism so we can get
this right.
-Sw.
class Server(object):
def __init__(self, interface, port, transport=TCP|UDP):
"""
Opens a socket and starts listening on a port.
"""
pass
def poll(self):
"""
Iterates the network selection queue, and posts events to
pygame event queue.
"""
pass
def disconnect(self):
"""
Breaks all client connections.
"""
pass
class Client(object):
def __init__(self, interface, port, transport=TCP|UDP,
reconnect_timeout=10):
"""
Attempts to Opens a socket and starts listening on a port.
Reconnects automatically.
"""
pass
def poll(self):
"""
Iterates the network selection queue, and posts events to
pygame event queue.
"""
pass
def disconnect(self):
"""
Break the socket connection.
"""
pass
def send(self, data):
"""
Sends data down socket.
"""
Events:
NETCONNECT:
server/client instance, ip, port, sequence_id, channel
NETRECV:
server/client instance, ip, port, data
NETDISCONNECT:
server/clent instance, ip, port, channel