php ws协议_PHP: 支持的协议和封装协议 - Manual

to create a raw tcp listener system i use the following:

xinetd daemon with config like:

service test

{

disable      = no

type         = UNLISTED

socket_type  = stream

protocol     = tcp

bind         = 127.0.0.1

port         = 12345

wait         = no

user         = apache

group        = apache

instances    = 10

server       = /usr/local/bin/php

server_args  = -n [your php file here]

only_from    = 127.0.0.1 #gotta love the security#

log_type     = FILE /var/log/phperrors.log

log_on_success += DURATION

}

now use fgets(STDIN) to read the input. Creates connections pretty quick, works like a charm.Writing can be done using the STDOUT, or just echo. Be aware that you're completely bypassing the webserver and thus certain variables will not be available.


版权声明:本文为weixin_42320061原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。