nrico
asked on
Peek into blocking sockets?
Is there a way to find out whether there is data waiting in the buffer of a blocking socket? I need to read out data if it's there, or don't if it's not. Problem with blocking sockets is that once you've begun a read operation, it does not return before that many bytes are actually read, which becomes a problem if those bytes never arrive, since your script just hangs.
I've tried socket_get_status(), which says that it returns the number of unread bytes in the socket buffer, but instead it always returns 0.
I've tried to set the sockets to non-blocking, but I don't really know how to use them that way.
Can anybody help?
I've tried socket_get_status(), which says that it returns the number of unread bytes in the socket buffer, but instead it always returns 0.
I've tried to set the sockets to non-blocking, but I don't really know how to use them that way.
Can anybody help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept mrvithan
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!