Binary Protocols over IP with python

Chris Tavares ctavares at develop.com
Mon May 28 04:16:12 EDT 2001


"Ng Mui" <ng_mui at my-deja.com> wrote in message
news:f6513a87.0105271136.5d45111e at posting.google.com...
> I'm a python newbie and want to know if it's suitable for prototyping
> binary protocols over UDP, TCP or raw IP sockets.
>
> I'm confident I can implement the basic socket stuff but what I'm not
> sure about is how to implement the messages I want to send...is there
> an example somewhere I can look at, or can someone describe it?
>
> I only saw text-based protocols like HTTP, Telnet, FTP in the python
libraries.
> It seems like everything is sent over a socket as a string, so how do
> I set a particular bit in a message or code an IP address as a sequence of
> bytes in a certain place in the message??
>
> Thanks for any tips
>
> NG MUI
>

Use the struct module to pack your binary message into a string, and then
send it.

-Chris






More information about the Python-list mailing list