| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> PHP de Socket han shu shen kao

PHP de Socket han shu shen kao

2008-12-19 08:07:32 编辑來源:互联网 评论
 
 
 
本文为【PHP的Socket函数参考】的拼音翻译版
  zhe xie Socket han shu zhi jie gen hu lian wang de xie yi jin xing fa song xin xi 。 xiang dui yu fopensock de liu lai jiang , ta men cao zuo zai yi ge bi jiao di ceng de ji bie 。 tong chang , ta men dou shi dui C han shu jin xing feng zhuang , bing qie ming cheng dou lei si 。 ru guo ni you shi yong C jin xing socket bian cheng de jing yan , na me shi yong zhe xie han shu jiang shi fei chang shu lian de 。 wo men zhe li bu tao lun te bie xiang xi de socket bian cheng 。
  shi yong zhe xie han shu neng gou jie jue gao ceng ji bie han shu suo bu neng jie jue de nan ti 。 shi yong zhe xie han shu neng gou shi xian lei si fopen de gong neng , ni ye xu you hen duo fang fa lai shi xian socket de gong neng , bi ru zai PHP zhong shi yong CLI(Command-line Interface) lai shi xian de Internet shou hu jin cheng 。
  resource socket_accept(resource socket)
  zai ni de jiao ben fu wu qi duan zhong , shi yong socket_accept jie shou yi ge jin ru de lian jie 。 ni bi xu shou xian chan sheng yi ge socket, bang ding ta dao yi ge ming zi , bing qie she zhi ta jian ting yi ge duan kou 。 zai kuai mo shi zhong ,socket_accept jiang chan sheng yi ge wei yi jie shou hou de lian jie 。 zai fei kuai mo shi zhong , ta mei you jian li lian jie ze fan hui false。 ling wai , dang ni you le yi ge xin de socket zi yuan hou jiu neng gou jin xing du xie cao zuo 。
  xia mian wo men jiang shi fan yi ge jian dan de hui xian fu wu qi duan 。 ta yun xing zai CLI( ming ling xing ) xia mian , ta zai 12345 duan kou deng dai ke hu duan de lian jie 。
  socket_accept
  <?php
   set_time_limit(0);
   //create the socket
   if(($socket = socket_create(AF_INET, SOCK_STREAM, 0)) < 0){
   print("Couldn't create socket: " . socket_strerror(socket_last_error()) . "\n");
   }
   //bind it to the given address and port
   if(($error = socket_bind($socket, gethostbyname($_SERVER['HOSTNAME']), 12345)) < 0){
   print("Couldn't bind socket: " . socket_strerror(socket_last_error()) . "\n");
   }
   if(($error = socket_listen($socket, 5)) < 0){
   print("Couldn't list on socket: " .
   socket_strerror(socket_last_error()) . "\n");
   }
   while(TRUE){
   //wait for connection
   if(($accept = socket_accept($socket)) < 0){
   print("Error while reading: " . socket_strerror($message) . "\n");
   break;
   }
   //send welcome message
   socket_write($accept, "Connection accepted\n");
   print(date('Y-m-d H:i:s') . " STATUS: Connection accepted\n");
   ob_flush();
   while(TRUE){
   //read line from client
   if(FALSE === ($line = socket_read($accept, 1024))){
   print("Couldn't read from socket: " .
   socket_strerror(socket_last_error()) . "\n");
   break 2;
   }
   if(accept]!@socket_write($accept, "ECHO: $line")){
   print(date('Y-m-d H:i:s') . " STATUS: Connection interrupted\n");
   break;
   }
   print(date('Y-m-d H:i:s') . " READ: $line");
   ob_flush();
   }
   socket_close($accept);
   }
  ?>
  bool socket_bind(resource socket, string address, integer port)
  zhe ge socket_bind() ba yi ge socket zi yuan bang ding zai yi ge di zhi shang 。 zhe ge socket bi xu you socket_create() han shu fan hui de yi ge zi yuan 。 zhe ge di zhi bi xu shi yi ge IP di zhi huo zhe shi yi ge bao cun Unix socket de lu jing 。 ru guo shi yun xing zai Internet shang de socket, ni huan bi xu ti gong yi ge duan kou 。
  socket_clear_error(resource socket)
  zhe ge han shu neng gou qing chu zhi ding socket de cuo wu , ru guo mei you zhi ding shen shu , na me jiang qing chu suo you socket de cuo wu 。
  socket_close(resource socket)
  socket_close han shu guan bi yi ge socket bing qie qing chu gai socket suo zhan yong de nei cun zi yuan 。
  boolean socket_connect(resource socket, string address, integer port)
  zhe ge han shu chuang jian yi ge ke hu duan dao yi ge duan kou huo zhe socket de lian jie 。 ni bi xu ti gong yi ge you socket_create chan sheng de socket。 zhe ge address shen shu bi xu dao yi ge socket de lu jing huo zhe shi yi ge IP di zhi 。 ru guo shi hou zhe , huan bi xu gen yi ge shu zi de duan kou hao 。
  xia mian li zi yan shi le shi yong UDP xie yi de lian jie dao you xi fu wu qi ran hou huo qu xin xi de guo cheng 。
  socket_connect
  <?php
   //create UDP socket
   if(($socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)) < 0){
   print("Couldn't create socket: " .
   socket_strerror(socket_last_error()) . "\n");
   }
   //timeout after 5 seconds
   socket_set_option($socket, SOL_SOCKET,
   SO_RCVTIMEO, array('sec'=>5,'usec'=>0));
   //connect to the RtCW master server
   if(!socket_connect($socket, 'wolfmaster.idsoftware.com', 27950)){
   print("Couldn't connect: " .
   socket_strerror(socket_last_error()) . "\n");
   }
   //send request for servers
   socket_write($socket, "\xFF\xFF\xFF\xFFgetservers\x00");
   //get servers
   $server = array();
   while(FALSE !== ($line = @socket_read($socket, 4096))){
   //parse data
   for($i=22; ($i+5) < strlen($line); $i += 7){
   $ip = ord(substr($line, $i+1, 1)) . '.' .
   ord(substr($line, $i+2, 1)) . '.' .
   ord(substr($line, $i+3, 1)) . '.' .
   ord(substr($line, $i+4, 1));
   $port = (ord(substr($line, $i+5, 1)) * 256) +
   ord(substr($line, $i+6, 1));
   $server[] = array('ip'=>$ip, 'port'=>$port);
   }
   }
   print("<h1>" . count($server) . " Servers</h1>\n");
   //loop over servers, getting status
   foreach($server as $s){
   print("<h1>{$s['ip']}:{$s['port']}</h1>\n");
   //connect to RtCW server
   if(!socket_connect($socket, $s['ip'], $s['port'])){
   print("<p>\n" .
   socket_strerror(socket_last_error()) .
   "\n</p>\n");
   continue;
   }
   //send request for status
   socket_write($socket, "\xFF\xFF\xFF\xFFgetstatus\x00");
   //get status from server
   if(FALSE === ($line = @socket_read($socket, 1024))){
   print("<p>\n" .
   socket_strerror(socket_last_error()) .
   "\n</p>\n");
   continue;
   }
   $part = explode("\n", $line);
   //settings are in second line separated by backslashes
   $setting = explode("\\", $part[1]);
   print("<h2>Configuration</h2>\n");
   print("<p>\n");
   for($s=1; $s < count($setting); $s += 2){
   print("\t\t{$setting[$s]} = {$setting[$s+1]}<br>\n");
   }
   print("</p>\n");
   print("<h2>Players</h2>\n");
   $lastPlayer = count($part) - 1;
   for($p=2; $p < $lastPlayer; $p++){
   $player = explode(" ", $part[$p]);
   print("{$player[2]} Score={$player[0]} " .
   "Ping={$player[1]}<br>\n");
   }
   print("</p>\n");
   ob_flush();
   }
   print("</table>\n");
   socket_close($socket);
  ?>
  resource socket_create(integer family, integer socket_type, integer protocol)
  socket_create chu shi hua yi ge socket de jie gou 。 di yi ge shen shu shi yi ge protocol family, huo zhe yu 。 ni bi xu shi yong AF_INET lai zhi ding yi ge Internet lian jie , huo zhe shi yong AF_UNIX lai zhi ding yi ge Unix socket lian jie 。 di er ge shen shu shi yi ge socket de lei xing , ni ke yi cong xia mian de biao zhong xuan ze 。 yi ban qing kuang xia , shi yong SOCK_STREAM lai shi yong TCP xie yi ,UDP xie yi shi yong SOCK_DGRAM。 di san ge shen shu zhi ding wei yi ge xie yi 。 shi yong SOL_TCP huo SOL_UDP lai fen bie dui ying TCP he UDP xie yi 。 huan you yi ge xuan ze shi ni neng gou shi yong getprotobyname han shu lai chu li 。
  Socket lei xing
  chang liang miao shu
  SOCK_DGRAM zi dong xun zhi shu ju bao socket
  SOCK_RAW RAW xie yi jie kou
  SOCK_RDM ke kao jiao huan xiao xi
  SOCK_SEQPACKET shun xu shu ju bao socket
  SOCK_STREAM liu socket
  resource socket_create_listen(integer port, integer backlog)
  shi yong socket_create_listen shi yi zhong bi socket_create geng jian dan de chan sheng yi ge socket jin xing jian ting 。 zhe ge chan sheng de socket jiang jian ting zhi ding de duan kou , hou mian ke xuan de shen shu backlog shi she zhi yuan xu zui da de lian jie shu 。
  boolean socket_create_pair(integer family, integer socket_type, integer protocol, array handles)
  socket_create_pair han shu chan sheng yi dui socket lian jie 。 shou xian qian san ge shen shu shi dui yi ge socket_create de miao shu , zhe ge handles shen shu shi yi ge bao han liang ge socket zi yuan de shu zu 。 gai han shu shi dui C li mian socketpair han shu de feng zhuang 。
  socket_create_pair
  <?php
   if(!socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $socket)){
   print("Couldn't make sockets!\n");
   exit();
   }
   $child = pcntl_fork();
   if($child == -1){
   print("Couldn't fork!\n");
   exit();
   }
   elseif($child > 0){
   //parent
   socket_close($socket[0]);
   print("Parent: waiting for message\n");
   $message = socket_read($socket[1], 1024, PHP_NORMAL_READ);
   print("Parent: got message--$message\n");
   socket_write($socket[1], "Hello, Child Process!\n");
   pcntl_waitpid($child, $status);
   }else{
   //child
   socket_close($socket[1]);
   socket_write($socket[0], "Hello, Parent Process!\n");
   print("Child: waiting for message\n");
   $message = socket_read($socket[0], 1024, PHP_NORMAL_READ);
   print("Child: got message--$message\n");
   exit(0);
   }
  ?>
  value socket_get_option(resource socket, integer level, integer option)
  socket_get_option han shu fan hui yi ge xia biao zhong suo lie de yi ge tian jia zhi , ni bi xu ti gong yi ge you socket_create chan sheng de socket zi yuan he yi ge deng ji 。 zhe ge huo qu de socket ji bie , ke yi shi yong SOL_SOCKET lai que ding zhe ge ji bie shen shu 。 ling wai , shi yong xie yi , bi ru xiang SOL_TCP lai biao shi yi ge TCP xie yi 。 zhe xie xuan xiang ke neng shi you socket_set_option she zhi de 。
  socket_get_options
  <?php
   $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
   print('SO_BROADCAST: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_BROADCAST) . "<br>\n");
   print('SO_DEBUG: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_DEBUG) . "<br>\n");
   print('SO_DONTROUTE: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_DONTROUTE) . "<br>\n");
   print('SO_ERROR: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_ERROR) . "<br>\n");
   print('SO_KEEPALIVE: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_KEEPALIVE) . "<br>\n");
   print('SO_LINGER: ' .
   print_r(socket_get_option($socket, SOL_SOCKET,
   SO_LINGER), TRUE) . "<br>\n");
   print('SO_OOBINLINE: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_OOBINLINE) . "<br>\n");
   print('SO_RCVBUF: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_RCVBUF) . "<br>\n");
   print('SO_RCVLOWAT: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_RCVLOWAT) . "<br>\n");
   print('SO_RCVTIMEO: ' .
   print_r(socket_get_option($socket, SOL_SOCKET,
   SO_RCVTIMEO), TRUE) . "<br>\n");
   print('SO_REUSEADDR: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_REUSEADDR) . "<br>\n");
   print('SO_SNDBUF: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_SNDBUF) . "<br>\n");
   print('SO_SNDLOWAT: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_SNDLOWAT) . "<br>\n");
   print('SO_SNDTIMEO: ' .
   print_r(socket_get_option($socket, SOL_SOCKET,
   SO_SNDTIMEO), TRUE) . "<br>\n");
   print('SO_TYPE: ' .
   socket_get_option($socket, SOL_SOCKET,
   SO_TYPE) . "<br>\n");
  ?>
  Socket xuan xiang biao
  xuan xiang miao shu
  SO_BROADCAST yuan xu zi dong xun zhi de socket fa song he jie shou guang bo bao
  SO_DEBUG da kai socket tiao shi gong neng , zhi you root cai you quan xian da kai gai xuan xiang
  SO_DONTROUTE bu jie shou lu you bao tong guo wang guan
  SO_ERROR huo qu bing qie qing chu zui hou yi ci de socket cuo wu , zhe ge xuan xiang ye xu bu yong she zhi
  SO_KEEPALIVE da kai bao chi ji huo zhuang tai de xiao xi
  SO_LINGER Socket_colse he socket_shutdown de zhong zhi xiao xi fa song chao shi , gai xuan xiang shi yong yi ge shu zu , bao kuo l_onoff he l_linger liang ge jian 。
  SO_OOBINLINE ba shu ju zhi jie cha ru dao jie shou huan chong
  SO_RCVBUF xian zhi jie shou huan chong de zui da zi jie
  SO_RCVLOWAT yan chi tong guo jie shou yi ge zui xiao de shu ju
  SO_RCVTIMEO yan chi bao gao yi ge jie shou chao shi bao gao , shi yong shu zu de liang ge jian :sec he usec
  SO_REUSEADDR yuan xu chong xin shi yong ben di di zhi
  SO_SNDBUF xian zhi fa song huan chong de zui da zi jie
  SO_SNDLOWAT yan chi fa song shu ju dao zhe ge xie yi dang jie shou yi ge zui xiao de zi jie
  SO_SNDTIMEO yan chi bao gao chao shi cuo wu , dang fa song fa song tong guo yi ge shi jian 。 gai xuan xiang shi yong shu zu de jian zhi :sec he usec
  SO_TYPE huo qu socket de lei xing , gai xuan xiang ke neng bu yong she zhi
  boolean socket_getpeername(resource socket, string address, integer port)
  socket_getpeername cong zhi ding de yi ge lian jie zhong huo qu di zhi he duan kou 。 ru guo lian jie wei Unix socket, na me jiang fan hui wen jian xi tong de lu jing 。
  boolean socket_getsockname(resource socket, string address, integer port)
  socket_getsockname fang zhi yi ge ming zi dao socket zhong , bing qie jia shang address he port shen shu 。 shi bai fan hui false。
  ( xia mian de socket_iovec_* han shu bu tai le jie , bu gan luan fan yi , bao liu yuan wen )
  boolean socket_iovec_add(resource iovector, integer length)
  The socket_iovec_add unction adds an I/O vector to the scatter/gather array.
  resource socket_iovec_alloc(integer count, …)
  The socket_iovec_alloc function returns a resource for handling a collection of I/O vectors. The first argument specifies the number of vectors. Following arguments specify the length of each vector.
  boolean socket_iovec_delete(resource iovector, integer position)
  The socket_iovec_delete function removes the I/O vector at the given position.
  string socket_iovec_fetch(resource iovector, integer position)
  The socket_iovec_fetch function returns the value of the specified vector in the I/O vector resource.
  boolean socket_iovec_free(resource iovector)
  The socket_iovec_free function frees the memory used for an I/O vector resource.
  boolean socket_iovec_set(resource iovector, integer position, string value)
  The socket_iovec_set sets the value of I/O vector at the given position.
  integer socket_last_error(resource socket)
  socket_last_error han shu fan hui cao zuo zhong de ren he socket han shu chan sheng de zui hou cuo wu 。 ni ye xu zai shang mian han shu zhong she zhi le socket zi yuan de socket xuan xiang zai zhi ding de lian jie shang 。 xia mian de biao lie chu le fan hui de cuo wu dai ma , ni tong yang ke yi shi yong soclet_strerror han shu lai huo qu xiang xi de cuo wu 。 shi yong socket_clear_error han shu qing chu socket de cuo wu 。
  Socket cuo wu dai ma biao
  chang liang miao shu
  SOCKET_E2BIG shen shu lie biao tai chang
  SOCKET_EACCES mei you xu ke quan xian
  SOCKET_EADDRINUSE di zhi yi jing bei shi yong
  SOCKET_EADDRNOTAVAIL bu neng jie xi qing qiu de di zhi
  SOCKET_EADV guang bo ( guang gao ) cuo wu
  SOCKET_EAFNOSUPPORT Address family bu zhi chi de xie yi
  SOCKET_EAGAIN zi yuan zan shi bu neng huo de
  SOCKET_EALREADY cao zuo yi jing zai zhi xing
  SOCKET_EBADE wu xiao de jiao huan
  SOCKET_EBADF cuo wu de wen jian miao shu fu
  SOCKET_EBADFD wen jian miao shu fu cuo wu de zhuang tai
  SOCKET_EBADMSG cuo wu de xiao xi
  SOCKET_EBADR wu xiao de qing qiu miao shu
  SOCKET_EBADRQC wu xiao de qing qiu dai ma
  SOCKET_EBADSLT wu xiao de cao zuo wei zhi
  SOCKET_EBUSY qu dong huo zi yuan fan mang
  SOCKET_ECHRNG xin dao hao ma chao chu fan wei
  SOCKET_ECOMM fa song tong xun cuo wu
  SOCKET_ECONNABORTED ruan jian yuan yin dao zhi tong xing zhong duan
  SOCKET_ECONNREFUSED lian jie bei ju jue
  SOCKET_ECONNRESET lian jie bei xiang tong de socket chong zhi
  SOCKET_EDESTADDRREQ bi xu xu yao mu biao di zhi
  SOCKET_EDQUOT chao chu ci pan pei e
  SOCKET_EEXIST wen jian yi cun zai
  SOCKET_EFAULT cuo wu de di zhi
  SOCKET_EHOSTDOWN zhu ji yi guan bi
  SOCKET_EHOSTUNREACH mei you lu you dao zhu ji
  SOCKET_EIDRM biao shi ID bei shan chu
  SOCKET_EINPROGRESS cao zuo zheng zai zhi xing
  SOCKET_EINTR xi tong tiao yong bei zu zhi
  SOCKET_EINVAL wu xiao de shen shu
  SOCKET_EIO shu ru / shu chu cuo wu
  SOCKET_EISCONN chuan shu zhong duan yi jing lian jie
  SOCKET_EISDIR shi yi ge mu lu
  SOCKET_EISNAM shi yi ge zhi ding de lei xing wen jian
  SOCKET_EL2HLT ji bie 2 yi zhong zhi
  SOCKET_EL2NSYNC ji bie 2 bu tong bu
  SOCKET_EL3HLT ji bie 3 yi zhong zhi
  SOCKET_EL3RST ji bie 3 bei chong zhi
  SOCKET_ELNRNG lian jie hao chao chu fan wei
  SOCKET_ELOOP tai duo ji bie de fu hao lian jie
  SOCKET_EMEDIUMTYPE cuo wu de mei jie lei xing ( zhong jian lei xing )
  SOCKET_EMFILE tai duo da kai de wen jian
  SOCKET_EMLINK tai duo de lian jie
  SOCKET_EMSGSIZE xiao xi tai chang
  SOCKET_EMULTIHOP chang shi ci shu tai duo
  SOCKET_ENAMETOOLONG wen jian ming tai chang
  SOCKET_ENETDOWN wang luo yi guan bi
  SOCKET_ENETRESET wang luo zhong duan , lian jie bei chong zhi
  SOCKET_ENETUNREACH wang luo bu ke da
  SOCKET_ENFILE xi tong zhong tai duo da kai de wen jian
  SOCKET_ENOANO mei you zheng ji
  SOCKET_ENOBUFS mei you ke yong de huan cun kong jian
  SOCKET_ENOCSI mei you ke yong de CSI jie gou
  SOCKET_ENODATA mei you ke yong de shu ju
  SOCKET_ENODEV mei you zhe yang de qu dong
  SOCKET_ENOENT mei you zhe yang de wen jian huo mu lu
  SOCKET_ENOLCK mei you ke yong de ji lu suo
  SOCKET_ENOLINK yi jing you de fu wu de lian jie
  SOCKET_ENOMEDIUM mei you mei jie bei zhao dao
  SOCKET_ENOMEM bu neng fen pei nei cun
  SOCKET_ENOMSG mei you zhi ding de xiao xi lei xing
  SOCKET_ENONET she bei bu zai wang luo shang
  SOCKET_ENOPROTOOPT xie yi bu ke yong
  SOCKET_ENOSPC mei you kong jian zai qu dong qi
  SOCKET_ENOSR chao chu de liu zi yuan
  SOCKET_ENOSTR qu dong bu shi yi ge liu
  SOCKET_ENOSYS han shu mei you zhi xing
  SOCKET_ENOTBLK kuai qu dong shi bi xu de
  SOCKET_ENOTCONN chuan shu zhong duan mei you lian jie
  SOCKET_ENOTDIR mei you yi ge mu lu
  SOCKET_ENOTEMPTY mu lu wei kong
  SOCKET_ENOTSOCK Socket cao zuo zai yi ge fei socket shang
  SOCKET_ENOTTY bu xiang fu de IO kong zhi qi
  SOCKET_ENOTUNIQ zai wang luo shang ming zi bu shi wei yi de
  SOCKET_ENXIO mei you zhe yang de qu dong huo di zhi
  SOCKET_EOPNOTSUPP cao zuo bu zhi chi
  SOCKET_EPERM cao zuo bu yuan xu
  SOCKET_EPFNOSUPPORT Protocol family bu zhi chi
  SOCKET_EPIPE shi bai de guan dao
  SOCKET_EPROTO xie yi cuo wu
  SOCKET_EPROTONOSUPPORT xie yi bu zhi chi
  SOCKET_EPROTOTYPE Socket shang xie yi cuo wu de lei xing
  SOCKET_EREMCHG yuan cheng di zhi yi gai bian
  SOCKET_EREMOTE dui xiang shi yuan cheng de
  SOCKET_EREMOTEIO yuan cheng I/O cuo wu
  SOCKET_ERESTART zhong duan de xi tong tiao yong jiang yao chong xin kai shi
  SOCKET_EROFS wen jian xi tong wei zhi du
  SOCKET_ESHUTDOWN. chuan shu duan dian zhong duan bu neng fa song
  SOCKET_ESOCKTNOSUPPORT Socket lei xing bu zhi chi
  SOCKET_ESPIPE bu he fa de jian suo
  SOCKET_ESTRPIPE liu guan dao cuo wu
  SOCKET_ETIME ding shi qi dao shi
  SOCKET_ETIMEDOUT lian jie chao shi
  SOCKET_ETOOMANYREFS tai duo lian jie wu fa jie he
  SOCKET_EUNATCH wu fa fu jia xie yi qu dong
  SOCKET_EUSERS tai duo yong hu
  SOCKET_EWOULDBLOCK zi yuan zan shi wu fa huo de
  SOCKET_EXDEV wu xiao de jiao cha qu dong lian jie
  SOCKET_EXFULL jiao huan yi man
  boolean socket_listen(resource socket, integer backlog)
  zhe ge socket_listen han shu deng dai cong ke hu duan guo lai de lian jie ,backlog shen shu she zhi yuan xu zui duo deng dai lian jie de dui lie shu 。
  string socket_read(resource socket, integer length, integer type)
  socket_read han shu cong te ding de socket zhong du qu zhi ding de zi jie , ru guo cuo wu fan hui false。 que sheng xia , shi cai yong er jin zhi an quan de du qu mo shi 。 ni ke yi wai zai de she zhi type shen shu wei PHP_BINARY_READ lai gai bian du qu mo shi 。 ni ye ke yi ba type she zhi wei PHP_NORMAL_READ。
  boolean socket_readv(resource socket, resource iovector)
  socket_readv han shu ba du qu de shu ju cha ru dao iovector zi yuan zhong 。
  integer socket_recv(resource socket, string buffer, integer length, integer flags)
  socket_recv han shu du qu shu ju cha ru dao huan chong zhong 。Length shen shu she zhi zui duo du qu de zi jie shu ,flag shen shu ke yi shi yong MSG_OOB huo MSG_PEEK。 han shu fan hui du qu de zi jie shu 。
  integer socket_recvfrom(resource socket, string buffer, integer length, string host, integer port)
  socket_frcvfrom han shu du qu shu ju cha ru dao huan cun zhong 。Length shen shu she zhi huo qu zui duo yuan xu jie shou de zi jie shu 。 she zhi flags shen shu ke yi wei MSG_OOB huo MSG_PEEK。PHP she zhi zhu ji he duan kou shen shu shi dang de zhi neng gou huo qu cong zhu ji fa chu de shu ju 。
  boolean socket_recvmsg(resource socket, resource iovector, array control, integer length, integer flags, string host, integer port)
  socket_recvmsg han shu cong socket zhong du qu shu ju bing qie cha ru dao yi ge I/O xiang liang zi yuan zhong 。PHP she zhi control shen shu shi yi ge ju you san ge yuan su de lian he shu zu :cmsg_level, cmsg_type, he cmsg_data。Length shen shu shi yi ge fu jia zai shu ju zhong de guan yu huo qu shu ju de chang du shen shu 。Flags shen shu shi she zhi yuan xu zhi he fan hui zhi 。 zai xie de shi jian ,PHP wu fa zhi xing suo you de shu chu chang liang 。PHP she zhi host he port shen shu shi dang de zhi shi wei le huo qu cong yuan cheng zhu ji zhong fa song de shu ju 。
  (Socket_slect han shu mei you fan yi , yin wei pa ci bu da yi )
  integer socket_select(array read, array write, array exception, integer timeout_seconds, integer timeout_microseconds)
  The socket_select function waits for changes to sockets. PHP watches the sockets given in the read array for new data coming in. PHP watches the streams given in the write array for being ready to accept more data. PHP watches the streams given in the exception argument for errors. If the number of seconds specified in the timeout_seconds argument passes, the function returns. Use the optional timeout_microseconds argument to specify a timeout less than 1 second.
  The socket_select function returns the number of sockets that changed or FALSE if an error occurred. If the call timed out, this function returns zero. It also modifies the given arrays so that they include only those sockets that changed.
  If you have no sockets of a particular type to watch, you may pass an empty array or a variable set to NULL.
  integer socket_send(resource socket, string buffer, integer length, integer flags)
  socket_send han shu ba xie shu ju dao huan chong zhong , ran hou cha ru dao lian jie zhong 。 ni bi xu zhi ding yi ge huan chong zui da ke xie zi jie shu 。 ni tong yang ke yi she zhi flags shen shu wei kong , huo zhe wei xia mian lian he chang liang zhong de yi ge :MSG_DONTROUTE he MSG_OOB。 han shu jie shu fan hui yi jing xie de zi jie shu , shi bai fan hui false。
  boolean socket_sendmsg(resource socket, resource iovector, integer flags, string address, integer port)
  socket_sendmsg chang shi fa song shu ju dao yi ge socket。 ta shi he wu lian jie de socket。Iovector shen shu shi yi ge tong guo socket_iovec_alloc han shu chan sheng de zi yuan 。 ni bi xu zhi ding flags shen shu wei :NULL, MSG_DONTROUTE, MSG_OOB, huo zhe shi liang ge lian he chang liang 。 ni ying dang zhi ding yi ge di zhi he yi ge Internet qing qiu de duan kou 。
  Socket_sendmsg han shu fa song shu ju fan hui true, dan shi bu neng bao zheng shu ju yi ding dao da 。
  integer socket_sendto(resource socket, string buffer, integer length, integer flags, string address, integer port)
  socket_sendto han shu chang shi xie shu ju dao buffer huan chong zhong , bing qie fa song gei yi ge socket。 ta shi he da bu fen wu lian jie de socket。 ni bi xu zhi ding flags wei :NULL,MSG_DONTROUTE,MSG_OOB huo zhe shi yi ge liang ge lian he chang liang 。 ni huan ying dan zhi ding di zhi he yi ge qing qiu de duan kou 。
  Socket_sendto han shu shu ju fa song chu qu fan hui true, dan shi bu neng bao zheng shu ju yi ding dao da 。
  boolean socket_set_block(resource socket)
  socket_set_block han shu she zhi socket cha ru dao yi ge kuai mo shi zhong , zhe shi que sheng mo shi 。 zai kuai mo shi zhong ,I/O cao zuo zheng dui yu yi ge wan cheng de qing qiu 。
  boolean socket_set_nonblock(resource socket)
  socket_set_nonblock han shu she zhi socket cha ru dao yi ge fei kuai mo shi zhong 。 zai fei kuai mo shi zhong ,I/O cao zuo ma shang fan hui , ji shi mei you shu ju 。
  boolean socket_set_option(resource socket, integer level, integer option, integer value)
  socket_set_option han shu gei socket she zhi yi ge xuan xiang 。Level shen shu she zhi yi ge biao zhi ji bie de chang liang 。 you xiao de zhi bao kuo :SOL_SOCKET, SOL_TCP he SOL_UDP。Option shen shu bi xu pi pei wen zhang shang mian de Socket xuan xiang biao zhong de chang liang 。
  boolean socket_shutdown(resource socket, integer how)
  socket_shutdown han shu guan bi yi ge guan yu I/O de socket。 she zhi how wei 0 ze zhong zhi jie shou shu ju , she zhi wei 1 ze ting zhi fa song shu ju , she zhi wei 2 ze zhong zhi er zhe cao zuo 。
  string socket_strerror(integer error)
  socket_strerror han shu fan hui yi ge cuo wu hao de xiang xi cuo wu xin xi 。
  integer socket_write(resource socket, string buffer, integer length)
  socket_write han shu xie shu ju dao buffer huan chong zhong ran hou shu chu dao socket zhong 。 ni ke yi zhi ding length shen shu lai zhi ding huan chong de zui da zi jie shu 。 zhe ge han shu tong chang qing kuang xia bi socket_send geng fang bian 。
  boolean socket_writev(resource socket, resource iovector)
  socket_writev han shu tong guo I/O xiang liang xie shu ju dao yi ge socket zhong 。【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
zhe xie Socket han shu zhi jie gen hu lian wang de xie yi jin xing fa song xin xi 。 xiang dui yu fopensock de liu lai jiang , ta men cao zuo zai yi ge bi jiao di ceng de ji bie 。 tong chang , ta men dou shi dui C han shu jin xing feng zhuang , bing qie ming cheng dou lei si 。 ru guo ni you shi yong C jin xing socket bian cheng de jing yan , na me shi yong zhe xie han shu jiang shi fei chang shu lian de 。 wo men zhe li bu tao lun te bie xiang xi de socket bian cheng 。 shi yong zhe xie han shu neng gou jie jue gao ceng ji bie han shu suo bu neng jie jue de nan ti 。 shi yong zhe xie han shu neng gou shi xian lei si fopen de gong neng , ni ye xu you hen duo fang fa lai shi xian socket de gong neng , bi ru zai PHP zhong shi yong CLI(Command-line Interface) lai shi xian de Internet shou hu jin cheng 。 resource socket_accept(resource socket) zai ni de jiao ben fu wu qi duan zhong , shi yong socket_accept jie shou yi ge jin ru de lian jie 。 ni bi xu shou xian chan sheng yi ge socket, bang ding ta dao yi ge ming zi , bing qie she zhi ta jian ting yi ge duan kou 。 zai kuai mo shi zhong ,socket_accept jiang chan sheng yi ge wei yi jie shou hou de lian jie 。 zai fei kuai mo shi zhong , ta mei you jian li lian jie ze fan hui false。 ling wai , dang ni you le yi ge xin de socket zi yuan hou jiu neng gou jin xing du xie cao zuo 。 xia mian wo men jiang shi fan yi ge jian dan de hui xian fu wu qi duan 。 ta yun xing zai CLI( ming ling xing ) xia mian , ta zai 12345 duan kou deng dai ke hu duan de lian jie 。 socket_accept <?php set_time_limit(0); //create the socket if(($socket = socket_create(AF_INET, SOCK_STREAM, 0)) < 0){ print("Couldn't create socket: " . socket_strerror(socket_last_error()) . "\n"); } //bind it to the given address and port if(($error = socket_bind($socket, gethostbyname($_SERVER['HOSTNAME']), 12345)) < 0){ print("Couldn't bind socket: " . socket_strerror(socket_last_error()) . "\n"); } if(($error = socket_listen($socket, 5)) < 0){ print("Couldn't list on socket: " . socket_strerror(socket_last_error()) . "\n"); } while(TRUE){ //wait for connection if(($accept = socket_accept($socket)) < 0){ print("Error while reading: " . socket_strerror($message) . "\n"); break; } //send welcome message socket_write($accept, "Connection accepted\n"); print(date('Y-m-d H:i:s') . " STATUS: Connection accepted\n"); ob_flush(); while(TRUE){ //read line from client if(FALSE === ($line = socket_read($accept, 1024))){ print("Couldn't read from socket: " . socket_strerror(socket_last_error()) . "\n"); break 2; } if([url=mailto:!@socket_write($accept]!@socket_write($accept[/url], "ECHO: $line")){ print(date('Y-m-d H:i:s') . " STATUS: Connection interrupted\n"); break; } print(date('Y-m-d H:i:s') . " READ: $line"); ob_flush(); } socket_close($accept); } ?> bool socket_bind(resource socket, string address, integer port) zhe ge socket_bind() ba yi ge socket zi yuan bang ding zai yi ge di zhi shang 。 zhe ge socket bi xu you socket_create() han shu fan hui de yi ge zi yuan 。 zhe ge di zhi bi xu shi yi ge IP di zhi huo zhe shi yi ge bao cun Unix socket de lu jing 。 ru guo shi yun xing zai Internet shang de socket, ni huan bi xu ti gong yi ge duan kou 。 socket_clear_error(resource socket) zhe ge han shu neng gou qing chu zhi ding socket de cuo wu , ru guo mei you zhi ding shen shu , na me jiang qing chu suo you socket de cuo wu 。 socket_close(resource socket) socket_close han shu guan bi yi ge socket bing qie qing chu gai socket suo zhan yong de nei cun zi yuan 。 boolean socket_connect(resource socket, string address, integer port) zhe ge han shu chuang jian yi ge ke hu duan dao yi ge duan kou huo zhe socket de lian jie 。 ni bi xu ti gong yi ge you socket_create chan sheng de socket。 zhe ge address shen shu bi xu dao yi ge socket de lu jing huo zhe shi yi ge IP di zhi 。 ru guo shi hou zhe , huan bi xu gen yi ge shu zi de duan kou hao 。 xia mian li zi yan shi le shi yong UDP xie yi de lian jie dao you xi fu wu qi ran hou huo qu xin xi de guo cheng 。 socket_connect <?php //create UDP socket if(($socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)) < 0){ print("Couldn't create socket: " . socket_strerror(socket_last_error()) . "\n"); } //timeout after 5 seconds socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec'=>5,'usec'=>0)); //connect to the RtCW master server if(!socket_connect($socket, 'wolfmaster.idsoftware.com', 27950)){ print("Couldn't connect: " . socket_strerror(socket_last_error()) . "\n"); } //send request for servers socket_write($socket, "\xFF\xFF\xFF\xFFgetservers\x00"); //get servers $server = array(); while(FALSE !== ($line = @socket_read($socket, 4096))){ //parse data for($i=22; ($i+5) < strlen($line); $i += 7){ $ip = ord(substr($line, $i+1, 1)) . '.' . ord(substr($line, $i+2, 1)) . '.' . ord(substr($line, $i+3, 1)) . '.' . ord(substr($line, $i+4, 1)); $port = (ord(substr($line, $i+5, 1)) * 256) + ord(substr($line, $i+6, 1)); $server[] = array('ip'=>$ip, 'port'=>$port); } } print("<h1>" . count($server) . " Servers</h1>\n"); //loop over servers, getting status foreach($server as $s){ print("<h1>{$s['ip']}:{$s['port']}</h1>\n"); //connect to RtCW server if(!socket_connect($socket, $s['ip'], $s['port'])){ print("<p>\n" . socket_strerror(socket_last_error()) . "\n</p>\n"); continue; } //send request for status socket_write($socket, "\xFF\xFF\xFF\xFFgetstatus\x00"); //get status from server if(FALSE === ($line = @socket_read($socket, 1024))){ print("<p>\n" . socket_strerror(socket_last_error()) . "\n</p>\n"); continue; } $part = explode("\n", $line); //settings are in second line separated by backslashes $setting = explode("\\", $part[1]); print("<h2>Configuration</h2>\n"); print("<p>\n"); for($s=1; $s < count($setting); $s += 2){ print("\t\t{$setting[$s]} = {$setting[$s+1]}<br>\n"); } print("</p>\n"); print("<h2>Players</h2>\n"); $lastPlayer = count($part) - 1; for($p=2; $p < $lastPlayer; $p++){ $player = explode(" ", $part[$p]); print("{$player[2]} Score={$player[0]} " . "Ping={$player[1]}<br>\n"); } print("</p>\n"); ob_flush(); } print("</table>\n"); socket_close($socket); ?> resource socket_create(integer family, integer socket_type, integer protocol) socket_create chu shi hua yi ge socket de jie gou 。 di yi ge shen shu shi yi ge protocol family, huo zhe yu 。 ni bi xu shi yong AF_INET lai zhi ding yi ge Internet lian jie , huo zhe shi yong AF_UNIX lai zhi ding yi ge Unix socket lian jie 。 di er ge shen shu shi yi ge socket de lei xing , ni ke yi cong xia mian de biao zhong xuan ze 。 yi ban qing kuang xia , shi yong SOCK_STREAM lai shi yong TCP xie yi ,UDP xie yi shi yong SOCK_DGRAM。 di san ge shen shu zhi ding wei yi ge xie yi 。 shi yong SOL_TCP huo SOL_UDP lai fen bie dui ying TCP he UDP xie yi 。 huan you yi ge xuan ze shi ni neng gou shi yong getprotobyname han shu lai chu li 。 Socket lei xing chang liang miao shu SOCK_DGRAM zi dong xun zhi shu ju bao socket SOCK_RAW RAW xie yi jie kou SOCK_RDM ke kao jiao huan xiao xi SOCK_SEQPACKET shun xu shu ju bao socket SOCK_STREAM liu socket resource socket_create_listen(integer port, integer backlog) shi yong socket_create_listen shi yi zhong bi socket_create geng jian dan de chan sheng yi ge socket jin xing jian ting 。 zhe ge chan sheng de socket jiang jian ting zhi ding de duan kou , hou mian ke xuan de shen shu backlog shi she zhi yuan xu zui da de lian jie shu 。 boolean socket_create_pair(integer family, integer socket_type, integer protocol, array handles) socket_create_pair han shu chan sheng yi dui socket lian jie 。 shou xian qian san ge shen shu shi dui yi ge socket_create de miao shu , zhe ge handles shen shu shi yi ge bao han liang ge socket zi yuan de shu zu 。 gai han shu shi dui C li mian socketpair han shu de feng zhuang 。 socket_create_pair <?php if(!socket_create_pair(AF_UNIX, SOCK_STREAM, 0, $socket)){ print("Couldn't make sockets!\n"); exit(); } $child = pcntl_fork(); if($child == -1){ print("Couldn't fork!\n"); exit(); } elseif($child > 0){ //parent socket_close($socket[0]); print("Parent: waiting for message\n"); $message = socket_read($socket[1], 1024, PHP_NORMAL_READ); print("Parent: got message--$message\n"); socket_write($socket[1], "Hello, Child Process!\n"); pcntl_waitpid($child, $status); }else{ //child socket_close($socket[1]); socket_write($socket[0], "Hello, Parent Process!\n"); print("Child: waiting for message\n"); $message = socket_read($socket[0], 1024, PHP_NORMAL_READ); print("Child: got message--$message\n"); exit(0); } ?> value socket_get_option(resource socket, integer level, integer option) socket_get_option han shu fan hui yi ge xia biao zhong suo lie de yi ge tian jia zhi , ni bi xu ti gong yi ge you socket_create chan sheng de socket zi yuan he yi ge deng ji 。 zhe ge huo qu de socket ji bie , ke yi shi yong SOL_SOCKET lai que ding zhe ge ji bie shen shu 。 ling wai , shi yong xie yi , bi ru xiang SOL_TCP lai biao shi yi ge TCP xie yi 。 zhe xie xuan xiang ke neng shi you socket_set_option she zhi de 。 socket_get_options <?php $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); print('SO_BROADCAST: ' . socket_get_option($socket, SOL_SOCKET, SO_BROADCAST) . "<br>\n"); print('SO_DEBUG: ' . socket_get_option($socket, SOL_SOCKET, SO_DEBUG) . "<br>\n"); print('SO_DONTROUTE: ' . socket_get_option($socket, SOL_SOCKET, SO_DONTROUTE) . "<br>\n"); print('SO_ERROR: ' . socket_get_option($socket, SOL_SOCKET, SO_ERROR) . "<br>\n"); print('SO_KEEPALIVE: ' . socket_get_option($socket, SOL_SOCKET, SO_KEEPALIVE) . "<br>\n"); print('SO_LINGER: ' . print_r(socket_get_option($socket, SOL_SOCKET, SO_LINGER), TRUE) . "<br>\n"); print('SO_OOBINLINE: ' . socket_get_option($socket, SOL_SOCKET, SO_OOBINLINE) . "<br>\n"); print('SO_RCVBUF: ' . socket_get_option($socket, SOL_SOCKET, SO_RCVBUF) . "<br>\n"); print('SO_RCVLOWAT: ' . socket_get_option($socket, SOL_SOCKET, SO_RCVLOWAT) . "<br>\n"); print('SO_RCVTIMEO: ' . print_r(socket_get_option($socket, SOL_SOCKET, SO_RCVTIMEO), TRUE) . "<br>\n"); print('SO_REUSEADDR: ' . socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR) . "<br>\n"); print('SO_SNDBUF: ' . socket_get_option($socket, SOL_SOCKET, SO_SNDBUF) . "<br>\n"); print('SO_SNDLOWAT: ' . socket_get_option($socket, SOL_SOCKET, SO_SNDLOWAT) . "<br>\n"); print('SO_SNDTIMEO: ' . print_r(socket_get_option($socket, SOL_SOCKET, SO_SNDTIMEO), TRUE) . "<br>\n"); print('SO_TYPE: ' . socket_get_option($socket, SOL_SOCKET, SO_TYPE) . "<br>\n"); ?> Socket xuan xiang biao xuan xiang miao shu SO_BROADCAST yuan xu zi dong xun zhi de socket fa song he jie shou guang bo bao SO_DEBUG da kai socket tiao shi gong neng , zhi you root cai you quan xian da kai gai xuan xiang SO_DONTROUTE bu jie shou lu you bao tong guo wang guan SO_ERROR huo qu bing qie qing chu zui hou yi ci de socket cuo wu , zhe ge xuan xiang ye xu bu yong she zhi SO_KEEPALIVE da kai bao chi ji huo zhuang tai de xiao xi SO_LINGER Socket_colse he socket_shutdown de zhong zhi xiao xi fa song chao shi , gai xuan xiang shi yong yi ge shu zu , bao kuo l_onoff he l_linger liang ge jian 。 SO_OOBINLINE ba shu ju zhi jie cha ru dao jie shou huan chong SO_RCVBUF xian zhi jie shou huan chong de zui da zi jie SO_RCVLOWAT yan chi tong guo jie shou yi ge zui xiao de shu ju SO_RCVTIMEO yan chi bao gao yi ge jie shou chao shi bao gao , shi yong shu zu de liang ge jian :sec he usec SO_REUSEADDR yuan xu chong xin shi yong ben di di zhi SO_SNDBUF xian zhi fa song huan chong de zui da zi jie SO_SNDLOWAT yan chi fa song shu ju dao zhe ge xie yi dang jie shou yi ge zui xiao de zi jie SO_SNDTIMEO yan chi bao gao chao shi cuo wu , dang fa song fa song tong guo yi ge shi jian 。 gai xuan xiang shi yong shu zu de jian zhi :sec he usec SO_TYPE huo qu socket de lei xing , gai xuan xiang ke neng bu yong she zhi boolean socket_getpeername(resource socket, string address, integer port) socket_getpeername cong zhi ding de yi ge lian jie zhong huo qu di zhi he duan kou 。 ru guo lian jie wei Unix socket, na me jiang fan hui wen jian xi tong de lu jing 。 boolean socket_getsockname(resource socket, string address, integer port) socket_getsockname fang zhi yi ge ming zi dao socket zhong , bing qie jia shang address he port shen shu 。 shi bai fan hui false。 ( xia mian de socket_iovec_* han shu bu tai le jie , bu gan luan fan yi , bao liu yuan wen ) boolean socket_iovec_add(resource iovector, integer length) The socket_iovec_add unction adds an I/O vector to the scatter/gather array. resource socket_iovec_alloc(integer count, …) The socket_iovec_alloc function returns a resource for handling a collection of I/O vectors. The first argument specifies the number of vectors. Following arguments specify the length of each vector. boolean socket_iovec_delete(resource iovector, integer position) The socket_iovec_delete function removes the I/O vector at the given position. string socket_iovec_fetch(resource iovector, integer position) The socket_iovec_fetch function returns the value of the specified vector in the I/O vector resource. boolean socket_iovec_free(resource iovector) The socket_iovec_free function frees the memory used for an I/O vector resource. boolean socket_iovec_set(resource iovector, integer position, string value) The socket_iovec_set sets the value of I/O vector at the given position. integer socket_last_error(resource socket) socket_last_error han shu fan hui cao zuo zhong de ren he socket han shu chan sheng de zui hou cuo wu 。 ni ye xu zai shang mian han shu zhong she zhi le socket zi yuan de socket xuan xiang zai zhi ding de lian jie shang 。 xia mian de biao lie chu le fan hui de cuo wu dai ma , ni tong yang ke yi shi yong soclet_strerror han shu lai huo qu xiang xi de cuo wu 。 shi yong socket_clear_error han shu qing chu socket de cuo wu 。 Socket cuo wu dai ma biao chang liang miao shu SOCKET_E2BIG shen shu lie biao tai chang SOCKET_EACCES mei you xu ke quan xian SOCKET_EADDRINUSE di zhi yi jing bei shi yong SOCKET_EADDRNOTAVAIL bu neng jie xi qing qiu de di zhi SOCKET_EADV guang bo ( guang gao ) cuo wu SOCKET_EAFNOSUPPORT Address family bu zhi chi de xie yi SOCKET_EAGAIN zi yuan zan shi bu neng huo de SOCKET_EALREADY cao zuo yi jing zai zhi xing SOCKET_EBADE wu xiao de jiao huan SOCKET_EBADF cuo wu de wen jian miao shu fu SOCKET_EBADFD wen jian miao shu fu cuo wu de zhuang tai SOCKET_EBADMSG cuo wu de xiao xi SOCKET_EBADR wu xiao de qing qiu miao shu SOCKET_EBADRQC wu xiao de qing qiu dai ma SOCKET_EBADSLT wu xiao de cao zuo wei zhi SOCKET_EBUSY qu dong huo zi yuan fan mang SOCKET_ECHRNG xin dao hao ma chao chu fan wei SOCKET_ECOMM fa song tong xun cuo wu SOCKET_ECONNABORTED ruan jian yuan yin dao zhi tong xing zhong duan SOCKET_ECONNREFUSED lian jie bei ju jue SOCKET_ECONNRESET lian jie bei xiang tong de socket chong zhi SOCKET_EDESTADDRREQ bi xu xu yao mu biao di zhi SOCKET_EDQUOT chao chu ci pan pei e SOCKET_EEXIST wen jian yi cun zai SOCKET_EFAULT cuo wu de di zhi SOCKET_EHOSTDOWN zhu ji yi guan bi SOCKET_EHOSTUNREACH mei you lu you dao zhu ji SOCKET_EIDRM biao shi ID bei shan chu SOCKET_EINPROGRESS cao zuo zheng zai zhi xing SOCKET_EINTR xi tong tiao yong bei zu zhi SOCKET_EINVAL wu xiao de shen shu SOCKET_EIO shu ru / shu chu cuo wu SOCKET_EISCONN chuan shu zhong duan yi jing lian jie SOCKET_EISDIR shi yi ge mu lu SOCKET_EISNAM shi yi ge zhi ding de lei xing wen jian SOCKET_EL2HLT ji bie 2 yi zhong zhi SOCKET_EL2NSYNC ji bie 2 bu tong bu SOCKET_EL3HLT ji bie 3 yi zhong zhi SOCKET_EL3RST ji bie 3 bei chong zhi SOCKET_ELNRNG lian jie hao chao chu fan wei SOCKET_ELOOP tai duo ji bie de fu hao lian jie SOCKET_EMEDIUMTYPE cuo wu de mei jie lei xing ( zhong jian lei xing ) SOCKET_EMFILE tai duo da kai de wen jian SOCKET_EMLINK tai duo de lian jie SOCKET_EMSGSIZE xiao xi tai chang SOCKET_EMULTIHOP chang shi ci shu tai duo SOCKET_ENAMETOOLONG wen jian ming tai chang SOCKET_ENETDOWN wang luo yi guan bi SOCKET_ENETRESET wang luo zhong duan , lian jie bei chong zhi SOCKET_ENETUNREACH wang luo bu ke da SOCKET_ENFILE xi tong zhong tai duo da kai de wen jian SOCKET_ENOANO mei you zheng ji SOCKET_ENOBUFS mei you ke yong de huan cun kong jian SOCKET_ENOCSI mei you ke yong de CSI jie gou SOCKET_ENODATA mei you ke yong de shu ju SOCKET_ENODEV mei you zhe yang de qu dong SOCKET_ENOENT mei you zhe yang de wen jian huo mu lu SOCKET_ENOLCK mei you ke yong de ji lu suo SOCKET_ENOLINK yi jing you de fu wu de lian jie SOCKET_ENOMEDIUM mei you mei jie bei zhao dao SOCKET_ENOMEM bu neng fen pei nei cun SOCKET_ENOMSG mei you zhi ding de xiao xi lei xing SOCKET_ENONET she bei bu zai wang luo shang SOCKET_ENOPROTOOPT xie yi bu ke yong SOCKET_ENOSPC mei you kong jian zai qu dong qi SOCKET_ENOSR chao chu de liu zi yuan SOCKET_ENOSTR qu dong bu shi yi ge liu SOCKET_ENOSYS han shu mei you zhi xing SOCKET_ENOTBLK kuai qu dong shi bi xu de SOCKET_ENOTCONN chuan shu zhong duan mei you lian jie SOCKET_ENOTDIR mei you yi ge mu lu SOCKET_ENOTEMPTY mu lu wei kong SOCKET_ENOTSOCK Socket cao zuo zai yi ge fei socket shang SOCKET_ENOTTY bu xiang fu de IO kong zhi qi SOCKET_ENOTUNIQ zai wang luo shang ming zi bu shi wei yi de SOCKET_ENXIO mei you zhe yang de qu dong huo di zhi SOCKET_EOPNOTSUPP cao zuo bu zhi chi SOCKET_EPERM cao zuo bu yuan xu SOCKET_EPFNOSUPPORT Protocol family bu zhi chi SOCKET_EPIPE shi bai de guan dao SOCKET_EPROTO xie yi cuo wu SOCKET_EPROTONOSUPPORT xie yi bu zhi chi SOCKET_EPROTOTYPE Socket shang xie yi cuo wu de lei xing SOCKET_EREMCHG yuan cheng di zhi yi gai bian SOCKET_EREMOTE dui xiang shi yuan cheng de SOCKET_EREMOTEIO yuan cheng I/O cuo wu SOCKET_ERESTART zhong duan de xi tong tiao yong jiang yao chong xin kai shi SOCKET_EROFS wen jian xi tong wei zhi du SOCKET_ESHUTDOWN. chuan shu duan dian zhong duan bu neng fa song SOCKET_ESOCKTNOSUPPORT Socket lei xing bu zhi chi SOCKET_ESPIPE bu he fa de jian suo SOCKET_ESTRPIPE liu guan dao cuo wu SOCKET_ETIME ding shi qi dao shi SOCKET_ETIMEDOUT lian jie chao shi SOCKET_ETOOMANYREFS tai duo lian jie wu fa jie he SOCKET_EUNATCH wu fa fu jia xie yi qu dong SOCKET_EUSERS tai duo yong hu SOCKET_EWOULDBLOCK zi yuan zan shi wu fa huo de SOCKET_EXDEV wu xiao de jiao cha qu dong lian jie SOCKET_EXFULL jiao huan yi man boolean socket_listen(resource socket, integer backlog) zhe ge socket_listen han shu deng dai cong ke hu duan guo lai de lian jie ,backlog shen shu she zhi yuan xu zui duo deng dai lian jie de dui lie shu 。 string socket_read(resource socket, integer length, integer type) socket_read han shu cong te ding de socket zhong du qu zhi ding de zi jie , ru guo cuo wu fan hui false。 que sheng xia , shi cai yong er jin zhi an quan de du qu mo shi 。 ni ke yi wai zai de she zhi type shen shu wei PHP_BINARY_READ lai gai bian du qu mo shi 。 ni ye ke yi ba type she zhi wei PHP_NORMAL_READ。 boolean socket_readv(resource socket, resource iovector) socket_readv han shu ba du qu de shu ju cha ru dao iovector zi yuan zhong 。 integer socket_recv(resource socket, string buffer, integer length, integer flags) socket_recv han shu du qu shu ju cha ru dao huan chong zhong 。Length shen shu she zhi zui duo du qu de zi jie shu ,flag shen shu ke yi shi yong MSG_OOB huo MSG_PEEK。 han shu fan hui du qu de zi jie shu 。 integer socket_recvfrom(resource socket, string buffer, integer length, string host, integer port) socket_frcvfrom han shu du qu shu ju cha ru dao huan cun zhong 。Length shen shu she zhi huo qu zui duo yuan xu jie shou de zi jie shu 。 she zhi flags shen shu ke yi wei MSG_OOB huo MSG_PEEK。PHP she zhi zhu ji he duan kou shen shu shi dang de zhi neng gou huo qu cong zhu ji fa chu de shu ju 。 boolean socket_recvmsg(resource socket, resource iovector, array control, integer length, integer flags, string host, integer port) socket_recvmsg han shu cong socket zhong du qu shu ju bing qie cha ru dao yi ge I/O xiang liang zi yuan zhong 。PHP she zhi control shen shu shi yi ge ju you san ge yuan su de lian he shu zu :cmsg_level, cmsg_type, he cmsg_data。Length shen shu shi yi ge fu jia zai shu ju zhong de guan yu huo qu shu ju de chang du shen shu 。Flags shen shu shi she zhi yuan xu zhi he fan hui zhi 。 zai xie de shi jian ,PHP wu fa zhi xing suo you de shu chu chang liang 。PHP she zhi host he port shen shu shi dang de zhi shi wei le huo qu cong yuan cheng zhu ji zhong fa song de shu ju 。 (Socket_slect han shu mei you fan yi , yin wei pa ci bu da yi ) integer socket_select(array read, array write, array exception, integer timeout_seconds, integer timeout_microseconds) The socket_select function waits for changes to sockets. PHP watches the sockets given in the read array for new data coming in. PHP watches the streams given in the write array for being ready to accept more data. PHP watches the streams given in the exception argument for errors. If the number of seconds specified in the timeout_seconds argument passes, the function returns. Use the optional timeout_microseconds argument to specify a timeout less than 1 second. The socket_select function returns the number of sockets that changed or FALSE if an error occurred. If the call timed out, this function returns zero. It also modifies the given arrays so that they include only those sockets that changed. If you have no sockets of a particular type to watch, you may pass an empty array or a variable set to NULL. integer socket_send(resource socket, string buffer, integer length, integer flags) socket_send han shu ba xie shu ju dao huan chong zhong , ran hou cha ru dao lian jie zhong 。 ni bi xu zhi ding yi ge huan chong zui da ke xie zi jie shu 。 ni tong yang ke yi she zhi flags shen shu wei kong , huo zhe wei xia mian lian he chang liang zhong de yi ge :MSG_DONTROUTE he MSG_OOB。 han shu jie shu fan hui yi jing xie de zi jie shu , shi bai fan hui false。 boolean socket_sendmsg(resource socket, resource iovector, integer flags, string address, integer port) socket_sendmsg chang shi fa song shu ju dao yi ge socket。 ta shi he wu lian jie de socket。Iovector shen shu shi yi ge tong guo socket_iovec_alloc han shu chan sheng de zi yuan 。 ni bi xu zhi ding flags shen shu wei :NULL, MSG_DONTROUTE, MSG_OOB, huo zhe shi liang ge lian he chang liang 。 ni ying dang zhi ding yi ge di zhi he yi ge Internet qing qiu de duan kou 。 Socket_sendmsg han shu fa song shu ju fan hui true, dan shi bu neng bao zheng shu ju yi ding dao da 。 integer socket_sendto(resource socket, string buffer, integer length, integer flags, string address, integer port) socket_sendto han shu chang shi xie shu ju dao buffer huan chong zhong , bing qie fa song gei yi ge socket。 ta shi he da bu fen wu lian jie de socket。 ni bi xu zhi ding flags wei :NULL,MSG_DONTROUTE,MSG_OOB huo zhe shi yi ge liang ge lian he chang liang 。 ni huan ying dan zhi ding di zhi he yi ge qing qiu de duan kou 。 Socket_sendto han shu shu ju fa song chu qu fan hui true, dan shi bu neng bao zheng shu ju yi ding dao da 。 boolean socket_set_block(resource socket) socket_set_block han shu she zhi socket cha ru dao yi ge kuai mo shi zhong , zhe shi que sheng mo shi 。 zai kuai mo shi zhong ,I/O cao zuo zheng dui yu yi ge wan cheng de qing qiu 。 boolean socket_set_nonblock(resource socket) socket_set_nonblock han shu she zhi socket cha ru dao yi ge fei kuai mo shi zhong 。 zai fei kuai mo shi zhong ,I/O cao zuo ma shang fan hui , ji shi mei you shu ju 。 boolean socket_set_option(resource socket, integer level, integer option, integer value) socket_set_option han shu gei socket she zhi yi ge xuan xiang 。Level shen shu she zhi yi ge biao zhi ji bie de chang liang 。 you xiao de zhi bao kuo :SOL_SOCKET, SOL_TCP he SOL_UDP。Option shen shu bi xu pi pei wen zhang shang mian de Socket xuan xiang biao zhong de chang liang 。 boolean socket_shutdown(resource socket, integer how) socket_shutdown han shu guan bi yi ge guan yu I/O de socket。 she zhi how wei 0 ze zhong zhi jie shou shu ju , she zhi wei 1 ze ting zhi fa song shu ju , she zhi wei 2 ze zhong zhi er zhe cao zuo 。 string socket_strerror(integer error) socket_strerror han shu fan hui yi ge cuo wu hao de xiang xi cuo wu xin xi 。 integer socket_write(resource socket, string buffer, integer length) socket_write han shu xie shu ju dao buffer huan chong zhong ran hou shu chu dao socket zhong 。 ni ke yi zhi ding length shen shu lai zhi ding huan chong de zui da zi jie shu 。 zhe ge han shu tong chang qing kuang xia bi socket_send geng fang bian 。 boolean socket_writev(resource socket, resource iovector) socket_writev han shu tong guo I/O xiang liang xie shu ju dao yi ge socket zhong 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
华丽的模特拍摄(8)
华丽的模特拍摄(7)
华丽的模特拍摄(6)
华丽的模特拍摄(5)
八里沟
朝阳宫
天下峨眉 云上金顶
老家(四)
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有