Sockets
Gordon McMillan
gmcm at hypernet.com
Wed Oct 10 08:39:44 EDT 2001
Hugo Martires wrote:
> My server need to send 2 strings separeted:
> s1= 'xxx'
> s2= 'yyy'
>
> My client must received like this:
> rec1= 'xxx'
> rec2= 'yyy'
>
> The problem is that the Client received s1 and s2 in one only string.
>
> How can i received in 2 separeted variables ?
That's why they're called STREAM sockets.
Most people would probably use a delimiter (say, a tab character).
But with large messages, or a congested network, you'll also have
to make sure your client has received the whole message.
In other words, you need to decide on a protocol.
Check out
http://www.mcmillan-inc.com/sock1.html
- Gordon
More information about the Python-list
mailing list