Socket Programming With PHP - Game Over (
Page 9 of 9 )
And that's about all I have
time for. In this article, you learned a little bit about PHP's socket
programming functions, using them to create and manipulate socket connections in
a networked environment. In addition to some simple examples, you also learned
how to apply PHP's socket API to real-life situations with practical examples,
including a POP3 client and an authentication server.
The latest version
of PHP, PHP 4.1.0, comes with an updated socket API, one which offers developers
greater control over socket creation and closely mimics the socket API used by
programming languages like C and C++. As of this writing, many of these new
functions have not yet been documented in the PHP manual; however, if you're
familiar with socket programming in C, you should have no trouble adapting your
code to use these new functions.
You can read up on PHP's socket
functions at
http://www.php.net/manual/en/ref.sockets.phpIf
you'd like to learn more about sockets and socket programming in general, here's
a list of sites you might want to consider visiting:
http://www.ecst.csuchico.edu/~beej/guide/nethttp://www.lcg.org/sock-faqhttp://www.onlamp.com/pub/a/php/2001/03/29/socket_intro.htmlhttp://phpbuilder.net/columns/armel20010427.php3?print_mode=1http://w3.softlookup.com/tcp_ipI
hope you found this article interesting, and that it helped open your eyes to
one of PHP's lesser-known capabilities. Let me know if you liked it...and, until
next time, stay healthy!
Note: All examples in this article have been
tested on Linux/i386 with Apache 1.3.12 and PHP 4.1.0. Examples are illustrative
only, and are not meant for a production environment. Melonfire provides no
warranties or support for the source code described in this article. YMMV!