kushal4 Posted August 11, 2017 Share Posted August 11, 2017 Hi,Is there any api function in php which whould tell how the length of packet recieved by the socket?For example there is an api function in C linux which ioctl() which returns the length of the packet recieved by the socket.Thanks Link to comment Share on other sites More sharing options...
requinix Posted August 11, 2017 Share Posted August 11, 2017 ioctl is very, very low level. Much lower than PHP is meant to go. If you're talking about a packet you received from a socket you have in your own code then just do an strlen() on the received string. Link to comment Share on other sites More sharing options...
kushal4 Posted August 11, 2017 Author Share Posted August 11, 2017 What i mean is i dont want to hardcode the value in socket_read() or any socket api function.First i want to know the length of the data which the socket has recieved and accordingly i want to perform socket_read() based on that length. Link to comment Share on other sites More sharing options...
requinix Posted August 11, 2017 Share Posted August 11, 2017 Make it non-blocking and pick a number. Or use socket_recv(). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.