As I started designing an interface for providing a Python interface over a socket, it became pretty obvious that a layer of abstraction over HawkNL was required... so I did what everyone should do.. wrap wrap wrap :D
The interface I've ended up with is quite simple, and doesn't try to do to much, which is usually a problem with any code written for public use.. it tries to do too much. So yeah, it's pretty slim,.. and non-blocking =)
Obviously different applications will have different ways of sending their data, some send it in plain text(ie, IRC), others, it's usually binary data(HTTP,Games). Initially the data goes from the HawkNL wrapper, to the SocketEventManager class, which will process the stream of raw data into a usable form. When it has gather enough raw data to be interpreted(ie, reaching a \n for IRC), the SEM will inform the NetworkEventManager, with news of a chunk of data which can now be processed. I figured two types of SEM would be useful:
1) A plain-text SEM, for text-based protocols, which informs the NEM when a full line of text has been recieved.
PlainTextSEM -> PlainTextNEM
2) A packet SEM, which will identify registered packets by a 2byte ID, and wait until the entire packet is in the buffer before notifying the NEM.
PacketSEM -> PacketNEM
The wrapper only requires that a class be registered with a Socket using a SEM interface, it does not require that a NEM be used, but as the PlainTextSEM and the PacketSEM would be bundled with the HawkNL wrapper, in order to prevent people from having twiddle with the innards of these classes, a NetworkEventManager has been added, to respond to events such as a line of text or complete packet being recieved.