Php Sockets vs Streams

后端 未结 2 1776
别那么骄傲
别那么骄傲 2021-01-30 09:36

I think php sockets and php streams are overlapping each other.
I\'ve managed to make a CLI PHP chat client and a server, using either sockets or streams.

Here som

2条回答
  •  清酒与你
    2021-01-30 09:47

    According to the manual, the sockets extension is more low-level. For instance, whith sockets you have finer-grained control when creating one, and can choose SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, etc.

    The socket extension implements a low-level interface to the socket communication functions based on the popular BSD sockets, providing the possibility to act as a socket server as well as a client.

    For a more generic client-side socket interface, see stream_socket_client(), stream_socket_server(), fsockopen(), and pfsockopen().

    source: http://www.php.net/manual/en/intro.sockets.php

提交回复
热议问题