php man page for socket_getsockname

Query: socket_getsockname

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

SOCKET_GETSOCKNAME(3)							 1						     SOCKET_GETSOCKNAME(3)

socket_getsockname  -  Queries	the local side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on
its type

SYNOPSIS
bool socket_getsockname (resource $socket, string &$addr, [int &$port])
DESCRIPTION
Note socket_getsockname(3) should not be used with AF_UNIX sockets created with socket_connect(3). Only sockets created with socket_accept(3) or a primary server socket following a call to socket_bind(3) will return meaningful values.
PARAMETERS
o $socket - A valid socket resource created with socket_create(3) or socket_accept(3). o $addr - If the given socket is of type AF_INET or AF_INET6, socket_getsockname(3) will return the local IP address in appropriate nota- tion (e.g. 127.0.0.1 or fe80::1) in the $address parameter and, if the optional $port parameter is present, also the associated port. If the given socket is of type AF_UNIX, socket_getsockname(3) will return the Unix filesystem path (e.g. /var/run/dae- mon.sock) in the $address parameter. o $port - If provided, this will hold the associated port.
RETURN VALUES
Returns TRUE on success or FALSE on failure. socket_getsockname(3) may also return FALSE if the socket type is not any of AF_INET, AF_INET6, or AF_UNIX, in which case the last socket error code is not updated.
SEE ALSO
socket_getpeername(3), socket_last_error(3), socket_strerror(3). PHP Documentation Group SOCKET_GETSOCKNAME(3)
Related Man Pages
sd_is_fifo(3) - debian
rpc_name_to_sockaddr(3ncs) - ultrix
socket_create_pair(3) - php
socket_set_option(3) - php
stream_socket_server(3) - php
Similar Topics in the Unix Linux Community
[Problem]Reuse port in BSD socket
hanging sockets!??!
socket system call can not succedd right after application crash.
Machine dependent problems when using Sockets.
Get process id and port from the socket