Home >Backend Development >PHP Tutorial >The difference between stream_socket_xxxx and socket_XXX in PHP

The difference between stream_socket_xxxx and socket_XXX in PHP

WBOY
WBOYOriginal
2016-07-06 13:53:461620browse

After reading the manual, I don’t quite understand the connection between stream_socket_xxxx and socket_xxx

For example: stream_socket_recvfrom and socket_recvfrom are functionally the same except for different parameters

Is it understandable that one is an extension of the other?

For example: stream_socket_client and socket_create both seem to be able to create socket resources, and stream is more powerful

My little brother has nothing to show for it. I just want to ask if I don’t understand.

PS: Suddenly I saw another fsocketopen. Why are there so many socket variants?

Reply content:

After reading the manual, I don’t quite understand the connection between stream_socket_xxxx and socket_xxx

For example: stream_socket_recvfrom and socket_recvfrom are functionally the same except for different parameters

Is it understandable that one is an extension of the other?

For example: stream_socket_client and socket_create both seem to be able to create socket resources, and stream is more powerful

My little brother has nothing to show for it. I just want to ask if I don’t understand.

PS: Suddenly I saw another fsocketopen. Why are there so many socket variants?

stream_socket_xxxx is an encapsulation of some functions such as sockets
More protocols are supported
http://php.net/manual/zh/wrappers.php

Almost the same content
Post an answer
http://stackoverflow.com/questions/9760548/php-sockets-vs-streams/9783856#9783856
Anyway, it is recommended to use the stream_* function

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn