Do any of the APIs available in PHP allow me to read from a TCP socket the TCP state machine’s current sequence number?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(AFAIK) No.
This would require access to the TCP header, which none of the sockets-based extensions (sockets or streams) will provide access to.
SOCK_STREAMonly provides the data payload, it does not (again, AFAIK) allow you get any information about the low level internal workings of the stream – because, in theory, you shouldn’t need to worry about it.It may (?) be possible to implement a TCP stream using
SOCK_RAW, in which case you could probably get access to this information, but I’m not even 100% confident about that, and you can be certain that even if it is, it would not be worth the bother.Having said all of that – depending on how good your lower level coding skills are, you may be able to build a PHP extension to interface with libpcap. You also might be able to do something by
exec()ing tcpdump, as long as it is available on the host system – although equally, I sort of doubt it, I suspect this would be very difficult if even possible to implement in a language that does not support multi-threading. Either of these options would require examining the payloads of packets and comparing them with what you had sent from PHP to sync up the data with the SEQ numbers.