Reputation:
I am sending data from a device every min through TCP/IP socket.
I am 1. Opening client socket. 2. Sending Packet. 3. Closing Socket.
I am closing socket for every packet. If I didnt close the client socket I was unable to receive data.
Any suggestions
Upvotes: 0
Views: 190
Reputation: 533790
When you close a socket, you also flush it's buffered data. If you have buffered data you should expect to not see all (possibly any) data if you don't flush() or close() the stream.
In your case, I suspect you just need to flush() the output.
Upvotes: 1