I m trying to sending the data over TCP/IP by segmenting it into different sizes ....with 10KB and 100KB the data is tranferring perfectly but when I segment it to 500KB ..it transfer sometime perfectly and sometime it failed by giving error
socket.error: [Errno 104] Connection reset by peer

This might help.

You might also put a try statement where the problem happens, and when it hits the except, make it send the data again until it gets through?

And maybe post the code that gives the error.