Skip to content Skip to sidebar Skip to footer

One Recv Gets Two Or More Send In Python Sockets

this is a simple socket program which has a server and some clients. clients send their texts encrypted by a simple RSA cryptography then the server side decrypts the sentence and

Solution 1:

This is an inherent part of TCP. Stream sockets are byte streams, not message streams.

So, things are working exactly as they're supposed to. If you want to send a sequence of messages over a TCP stream, it's exactly the same problem as saving a sequence of objects to a file—you need some way of delimiting the messages. This could be as simple as using a stream of text, where newlines delimit the messages, or it could be a complex protocol, but it has to be something.

See this blog post for more detail.

Post a Comment for "One Recv Gets Two Or More Send In Python Sockets"