PHP
  Home arrow PHP arrow Developing an Extensible TCP Server with Sockets in PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Developing an Extensible TCP Server with Sockets in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2006-05-30


    Table of Contents:
  • Developing an Extensible TCP Server with Sockets in PHP
  • A quick look at the previous TCP server
  • Expanding the original TCP server: processing multiple client requests
  • Defining the createSocketServer() function and the SocketServer class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Developing an Extensible TCP Server with Sockets in PHP
    ( Page 1 of 4 )

    Are you interested in learning how to manipulate low-level sockets in PHP? Your search has finished. This is the second part of the series “Handling sockets in PHP,” and hopefully you’ll find in it valuable material regarding the creation and manipulation of sockets with PHP, in conjunction with numerous illustrative hands-on examples that will help you build socket servers in a few easy steps.

    Introduction

    For those who haven't read my first tutorial yet, let me briefly recapitulate the topics that I treated previously. To begin with, I explained how to create a low-level socket in PHP and perform some key operations with it, such as pushing in and pulling out data streams.

    Aside from covering some key points related to handling sockets, I set up a complete example, which focused on developing a simple TCP server and the corresponding client. In this way I demonstrated how they can communicate with each other, introducing some kind of basic processing on the traveling data.

    After testing the sample TCP server that I developed in the first article, surely you'll realize the excellent capabilities that come with PHP for handling sockets, and more generally for addressing common issues associated with network programming. Going deeper into socket manipulation, building end-to-end communication channels as part of an application allows you to understand much better the logic behind the relationship between server and clients. Considering this crucial concept, programming sockets in PHP can be a useful experience.

    Now, focusing specifically on this second article of the series, I'll go one step further in the manipulation of low-level sockets, and show you how to expand the TCP server that was constructed previously, in order to provide it with the ability to attend to multiple requests coming from the same client. Hopefully, this experience will help you to get a more intimate knowledge of socket handling in PHP.

    With the preliminaries out of the way, let's get started.



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT