PHP 5.6.16 is available


(PHP 4 >= 4.3.0, PHP 5)

socket_get_optionPega opções de socket para o socket


mixed socket_get_option ( resource $socket , int $level , int $optname )

Esta função é EXPERIMENTAL. O comportamento, seu nome e documentação podem mudar sem aviso em futuras versões do PHP. Utilize por sua própria conta e risco.


Esta função não está documentada; somente a lista de argumentos está disponível.


Essa função é para ser usada chamando socket_getopt() primeiramente para PHP 4.3.0

add a note add a note

User Contributed Notes 3 notes

Chad Lavoie
4 years ago
If using Unix Sockets, and you want to use SO_PEERCRED, you can use the number 17 for the optname (and SOL_SOCKET for the level).  The PID of the connecting process will be returned.
prennings at gmail dot com
1 year ago
I was playing around with this option to use multiply socket connections with same hostname and same port (IRC). However the socket function needed for this is SO_REUSEPORT.

Though the majority of linux distro's does not have that yet officially implented in there distro's.

However for debian there is an patch that can be installed to get it working:

it has some work but I got it working after a while (Noobie in debian) maybe some other people are facing the same problem as I was.
recycling dot sp dot am at gmail dot com
5 years ago
Just 2 notes here:
- On UNIX, If SO_DEBUG is set, the php program needs an effective user id of 0.
-  activating SO_OOBINLINE on a socket is equivalent to passing MSG_OOB flag to each recieving functions used with that socket (eg: socket_recv, socket_recvfrom).
To Top