[ENet-discuss] ENet Python wrapper

Ling Lo enet-discuss@lists.puremagic.com
Sat, 1 Feb 2003 18:37:37 -0000


Hello chaps,

I threw together a Python wrapper for ENet which somewhat OO's the API and
replaces ENetPackets in favour of strings.

http://www.slimy.com/~ling/enet.zip (hopefully my host doesn't mind, it's
slow tho, be warned)

For peer review, below is from vstudio/readme.txt.  It's inevitably bugged
having received, um, 2 minutes of testing.  It's also incomplete, lacking
access to variables on host and peers.  Anyway, release early as it were.

Compiled for VC.NET, requires Python include and library directories in IDE,
definitely work in progress, no support provided, same licence as ENet,
whatever that is.

Also, nice work on ENet, I dig with JCB digger.
--
  |   Ling Lo
_O_O_

-------
Module Summary

Constants

EVENT_NONE - Hopefully never get this and can remove
EVENT_CONNECT - Event type, new peer
EVENT_DISCONNECT - Event type, lost peer
EVENT_RECEIVE - Event type, contains data
FLAG_RELIABLE - Use when sending packets to indicate reliable

Contains one function to create a host:

host host((addr, port), int peercount, int incomingbandwidth,
                                       int outgoingbandwidth)
    For creating servers.

host host(int peercount, int incomingbandwidth, int outgoingbandwidth)
    For creating clients

Host Object
===========
void host.destroy()
peer host.connect((string addr, int port), int numchannels)
result, event host.service(int timeout)
void host.flush()
void host.broadcast(int channel, string data, int flags)
void host.bandwidthlimit(int incomingbandwidth, int outgoingbandwidth)

Peer Object
===========
void peer.send(int channel, string data, int flags)
string peer.receive(int channel)
void peer.ping()
void peer.reset()
void peer.disconnect()
void peer.throttle_configure(int interval, int accel, int decel)

Event Object
============
int event.type
peer event.peer
int event.channel
string event.data