I need to read data, being passed into the socket, from a C application.
The data comes in as a string, but does not seem to be null terminated.
It does NOT have a carriage return at the end.
if I use readline it just freezes waiting for what I believe is a carriage return.
Using read (not readline) I am not sure how to detect the end of the message.
Currently the data is being read via another C program, and it somehow knows how to detect the end of the message.
It is not looking for a specific character, it is not looking for a specific number of bytes.
It just knows, and then returns the number of bytes sent.
(maybe the other side is disconnecting after sending the message?, I can not think of any other way, it can know, that the message has ended.)
I have no visibility into the code on the other side.
Can someone point me to a good example, of a socket read, that does character by character, and then knows when to stop reading characters, based on the other side disconnecting?
Or maybe even suggest another way to do this?
Thank you
The data comes in as a string, but does not seem to be null terminated.
It does NOT have a carriage return at the end.
if I use readline it just freezes waiting for what I believe is a carriage return.
Using read (not readline) I am not sure how to detect the end of the message.
Currently the data is being read via another C program, and it somehow knows how to detect the end of the message.
It is not looking for a specific character, it is not looking for a specific number of bytes.
It just knows, and then returns the number of bytes sent.
(maybe the other side is disconnecting after sending the message?, I can not think of any other way, it can know, that the message has ended.)
I have no visibility into the code on the other side.
Can someone point me to a good example, of a socket read, that does character by character, and then knows when to stop reading characters, based on the other side disconnecting?
Or maybe even suggest another way to do this?
Thank you