[Tutor] sockets
Kent Johnson
kent37 at tds.net
Thu May 4 03:46:42 CEST 2006
Matt Richardson wrote:
> Just verifying what I looked up earlier: are strings and binary
> (through struct.pack) the only data types that can be sent through a
> socket? This is my first crack at socket programming, so I'll probably
> have lots of questions to bug you with.
The socket library gives low-level access to socket connections. At this
level, the only type of data is a byte stream which in Python is
represented by a string.
There are higher-level protocols that support more structured data. You
can use the pickle module to convert most data structures to strings
which can be sent over a socket. XML-RPC is a remote procedure call
standard that supports simple data structures; it is supported in
xmlrpclib and SimpleXMLRPCServer. PyRO is another remote object protocol
that is Python-specific.
What is it you want to do?
Kent
More information about the Tutor
mailing list