lrs_get_socket_attrib

Example: lrs_get_socket_attribSockets Functions

Gets a socket's attributes.

char *lrs_get_socket_attrib( char *s_desc , int attribute );
s_desc A descriptor identifying the socket.
attribute A socket attribute.

The lrs_get_socket_attrib function retrieves the specified socket attribute. This allows you to get information about the socket. You can only retrieve attributes from sockets that were bound or connected to a socket. To bind a socket to an existing socket, use lrs_create_socket(...LocalPort=...). To connect to a socket, use lrs_create_socket(...RemoteHost=...).

The available attributes are:

LOCAL_ADDRESS The IP address (in standard dotted form) of the machine running the script.
LOCAL_HOSTNAME The host name of the local machine.
LOCAL_PORT The port number of the socket in the host byte order. This may be used for either bounded or connected sockets.
REMOTE_ADDRESS The IP address of the peer machine. (TCP sockets only)
REMOTE_HOSTNAME The host name of the peer machine. (TCP sockets only)
REMOTE_PORT The port number of the peer socket in the host byte order. (TCP sockets only)

Return Values

This function returns the value of the specified attribute as a string. If no value is available, it returns NULL.

Parameterization

You cannot use standard parameterization for any arguments in this function.