php socket ä¯ÀÀÆ÷
<?PHP
/**
* patServer
* PHP socket server base class
* Events that can be handled:
* * onStart
* * onConnect
* * onConnectionRefused
* * onClose
* * onShutdown
* * onReceiveData
*
* @version 1.1
* @author Stephan Schmidt <schst@php-tools.de>
* @package patServer
*/
class patServer{
/**
* information about the project
* @var array $systemVars
*/
var $systemVars = array(
"appName" => "patServer",
"appVersion" => "1.1",
"author" => array("Stephan Schmidt <schst@php-tools.de>", )
);
/**
* port to listen
* @var integer $port
*/
var $port = 63333;
/**
* domain to bind to
* @var string $domain
*/
var $domain = "192.168.10.2";
/**
* maximum amount of clients
* @var integer $maxClients
*/
var $maxClients = -1;
/**
* buffer size for socket_read
* @var integer $readBufferSize
*/
var $readBufferSize = 128;
/**
* end character for socket_read
* @var integer $readEndCharacter
*/
var $readEndCharacter = "\n";
/**
* maximum of backlog in queue
* @var integer $maxQueue
*/
var $maxQueue = 500;
/**
* debug mode
* @var boolean $debug
*/
var $debug = true;
/**
* debug mode
* @var string $debugMode
*/
var $debugMode = "text";
/**
* debug destination (filename or stdout)
* @var string $debugDest
*/
var $debugDest = "stdout";
/**
* empty array, used for socket_select
* @var array $null
*/
var $null = array();
/**
* all file descriptors are stored here
* @var array $clientFD
*/
var $clientFD = array();
/**
* needed to store client information
* @var array $clientInfo
*/
&nbs
Ïà¹ØÎĵµ£º
WindowsÏÂPHPµÄ°²×°ËäÈ»¼òµ¥£¬µ«Èç¹û²»×¢Òâ·½·¨£¬ÈÔÈ»»áÈÃÄãÍ·ÌÛ¡£´ËÍ⣬PHP 5.2°æ±¾Óë֮ǰ4.x°æ±¾Ò²ÓÐһЩ²»Í¬£¬ËùÒÔÓбØÒª¼Ç¼һÏ£¬±ÜÃâÏ´ÎÍü¼ÇÁËÕâÑùµÄ°²×°ÅäÖ÷½·¨¡£
²½ÖèÒ»£ºÏÂÔØphp 5.2 for windowsµÄ°²×°°ü£¬½âѹÖÁC:\php¡£×¢Òâ´Ë½âѹĿ¼¿ÉÒÔÊÇÔÚÈκÎÅÌÏ£¬È»¶øĿ¼Ãû²»ÄÜ°üº¬¿Õ¸ñ£»
ÒÔÏÂÊÇphp5.2µÄÎļþĿ¼£º
......
ת×Ô£º http://www.phpsoho.com/article/php/200809/09-239.html
Èç¹û Web Ó¦ÓóÌÐòÖеÄÒ»¸öÌØÐÔÐèÒª³¬¹ý 1 Ãë»ò 2 Ãë²ÅÄÜÍê³É£¬ÄÇôӦ¸ÃÔõô°ì£¿ÐèҪijÖÖÀëÏß´¦Àí½â¾ö·½°¸¡£Ñ§Ï°¼¸ÖÖ¶Ô PHP Ó¦ÓóÌÐòÖг¤Ê±¼äÔËÐеÄ×÷Òµ½øÐÐÀëÏß·þÎñµÄ·½·¨¡£
´óÐ͵ÄÁ¬ËøµêÓÐÒ»¸ö´óÎÊÌ⡣ÿÌ죬ÔÚÿ¼ÒÉ̵ê»á·¢ÉúÊýǧ´Î½»Òס ......
ŪÁË°ëÌì, PHP ÖÕÓÚÄܵ÷ÓÃÎÒµÄC# dll ÁË.
¸ÃËÀµÄ,ÎÒ¶ÔC# COM×¢²áÒ»Ïò²»Á˽â, PHP ÎĵµÉÏÖ»¸øPHPÄDz¿·ÖÄÚÈÝ,û¸æËßÎÒÔõôŪdll
ÎÒ»¹ÉµÙâÙâµÄÓà Regsvr32 ×¢²áÄǸöc# dll.
±³¾°:
Windows xp sp3 ; apache 2.2.14 ; php 5.2.12 ;
VS2010 beta ;
ÓïÑÔ:
PHP5 , C#
C#²¿·Ö:
´´½¨Ò»¸ö C# Class Library . (dll) ......
1.Appserv ÊÇʲô£¿
Appserv ÊÇPHPÍøÒ³¼ÜÕ¾¹¤¾ß×éºÏ°ü£¬¿ÉÒÔ½«ÍøÂçÉÏÃâ·ÑµÄ¼ÜÕ¾×ÊÔ´ÖØаü×°³Éµ¥Ò»µÄ°²×°³ÌÐò¡£ËüÌṩÁ˼òÒס¢¿ìËÙµÄPHPÔËÐл·¾³µÄ´î½¨»úÖÆ£¬¶ÁÕßÖ»Ðè°´ÕÕÆÕͨӦÓÃÈí¼þµÄ°²×°·½Ê½¾Í¿ÉÒÔÍê³ÉApache+MySQL+PHP+phpMyAdminµÄ°²×°ÓëÅäÖù¤×÷¡£
2.Appserv ÏÂÔصØÖ·
http://www. ......
±¾ÎÄת×Ô http://hi.baidu.com/kxw102/blog/item/f1303188d9c148bb0e2444f2.html£¬¸Ðл×÷ÕߵķÖÏí
ÔÚ
PHP
ÖУ¬»ù±¾Êý¾Ý¿ÉÒÔ·ÖΪ³£Á¿ºÍ±äÁ¿Á½ÖÖ¡£³£Á¿ÃûºÍ±äÁ¿Ãûͨ³£³ÆΪ±êʶ·û¡£(
ÐèҪעÒâµÄÊDZêʶ·û±ØÐëÒÔ×Öĸ»òÕßÏ»®Ïß¿ªÍ·£¬²¢ÇÒÖ»ÄÜ°üÀ¨×Öĸ¡¢Êý×ÖºÍÏ»®Ïß
)
ÀýÈ磺
my_function¡¢Size¡¢
_BlackµÈµÈ
1.ÏÂÃæËµÏ ......