Home  >  Article  >  Backend Development  >  PHP套接字链接有关问题

PHP套接字链接有关问题

WBOY
WBOYOriginal
2016-06-13 10:23:421003browse

PHP套接字链接问题
PHP代码如下:

C# code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $connection = socket_connect($socket, $IP, 2012);  

明明我本机上的2012端口已经处于监听状态,为什么从别的机子上的PHP不能连接到我机子上的2012端口,从本机的PHP就能连接到?该怎样设置?

------解决方案--------------------
客户端的网络环境很复杂,你的IP是不可能被服务器访问的,除非在那个路由器那里,做一个转发
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:eclipse 编写php异常Next article:php.ini的有关问题