socket_get_option

(PHP 4 >= 4.3.0, PHP 5)

socket_get_optionPega opções de socket para o socket

Descrição

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

Esta função é EXPERIMENTAL. O comportamento desta função, seu nome, incluindo toda documentação pode ser modificado sem aviso em futuras versões do PHP. Esta função deve ser usada por sua própria conta e risco.

Aviso

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

Nota:

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

up
1
Chad Lavoie
3 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.
up
1
recycling dot sp dot am at gmail dot com
4 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).
up
0
prennings at gmail dot com
8 months 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:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c617f398edd4db2b8567a28e899a88f8f574798d

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.
To Top