walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.

Home Page:http://www.workerman.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No way to get Server IP and Port directly

joanhey opened this issue · comments

Hi, Walkor

I want to add $_SERVER['SERVER_ADDR'] to Adapterman, but I can't find a direct way to get it.

I can create it in the Http.php, from Worker->socketName.
But perhaps it will be better to be in the Worker.php, as it's useful in many apps.

@walkor What do you think is the best way or alternative ?

commented

Hmmm;
getRemoteIP() is the ip of the client, not the Server IP.

Update: Connection also have getLocalIp() and getLocalPort(). It isn't very fast, but we will update it later.