How does PHP send a byte to a port of an IP address?

Source: Internet
Author: User
How does PHP send a byte to a port of an IP address? For example, if a byte is sent to Port 2012 of port 202.117.120.241, and the 8-bit bytes are 00100000, how can this problem be achieved ?, $ Fp = fsoctopen ('192. 117.120.241 ', 202); fwrite ($ fp, chr (how does bind PHP send a byte to a port of an IP address?
For example, if you want to send a byte to Port 2012 of port 202.117.120.241 and the 8-bit bytes are 00100000, how can this problem be implemented?

------ Solution --------------------
$ Fp = fsoctopen ('192. 117.120.241 ', 202 );
Fwrite ($ fp, chr (bindec ('20140901 ')));
------ Solution --------------------
Fsocketopen ();
------ Solution --------------------
Dizzy ..
Fsockopen ();
------ Solution --------------------
PHP code
$ Fp = fsockopen ('192. 117.120.241 ', 202, $ ercode, $ ermsg); if ($ ercode! = 0) exit ('Error: '. $ ermsg); $ st = sprintf ("% B", 00100000); fread ($ fp, $ st );
------ Solution --------------------
This is probably because the host of 202.117.120.241 does not listen to Port 2012. This is not caused by code problems.
In addition, I wrote
$ St = sprintf ("% B", 00100000); is incorrect. I have incorrect understanding of binary bytes. The first floor is correct.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.