note 50286 added to function.socket-listen
| From: | john at bhdnet dot com | Date: | Wed, 23 Feb 2005 20:14:47 +0000 |
| Subject: | note 50286 added to function.socket-listen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85451@lists.php.net to get a copy of this message | ||
One suggestion for the above example for working with UDP.
The example uses the same socket to connect to a machine thus closing the listening socket and
forcing the re-creation of a new UDP socket and wasting alot of processor time.
Instead it would be better to follow the standard TCP/IP operation method whereby you have one
socket listening and create new sockets to form active connections.
So when the UDP socket is incoming create a new socket identical (bind to a different port number)
and then connect.
Of course, if you wanted bi-directional communication you should always use TCP/IP because it is
more reliable and has methods of packet arrangement and recovery.
----
Manual Page -- http://www.php.net/manual/en/function.socket-listen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50286
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50286&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50286&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50286&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50286&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50286&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50286&report=yes
Search -- http://master.php.net/manage/user-notes.php