J
John Ramsden
I am using the IO::Select method can_write() to flow control the writing
of a large amount of data to a socket, where the writer may well run ahead
of the receiver at the other end and thus cause the local buffer to become
full.
I gather the can_write() method takes care of that, by only returning
true when the outgoing buffer is not full. But how does one distinguish
this from the situation where the remote process has closed its end of
the socket connection?
I'm happy to set a large timeout for can_write(), and call it in a loop,
while the connection is open and the receiver will sooner or later get
round to reading its end of the socket and thereby clear the log jam.
But obviously the sender will loop forever if can_write() is returning
false because the receiver process has packed up and gone home!
Cheers
John Ramsden ([email protected])
of a large amount of data to a socket, where the writer may well run ahead
of the receiver at the other end and thus cause the local buffer to become
full.
I gather the can_write() method takes care of that, by only returning
true when the outgoing buffer is not full. But how does one distinguish
this from the situation where the remote process has closed its end of
the socket connection?
I'm happy to set a large timeout for can_write(), and call it in a loop,
while the connection is open and the receiver will sooner or later get
round to reading its end of the socket and thereby clear the log jam.
But obviously the sender will loop forever if can_write() is returning
false because the receiver process has packed up and gone home!
Cheers
John Ramsden ([email protected])