<< Previous | Index | Next >>

getsockname


int getsockname( sock_type *s, void *dest, int *len );

Description

Gets the controller's IP address and port information for a particular socket.

Parameters

s

Pointer to the socket.

dest

Pointer to sockaddr to hold the socket information for the local end of the socket. The data structure is:


typedef struct sockaddr {
word s_type; //
reserved
word s_port; //
port #, or 0 if not connected
longword s_ip; // IP addr, or 0 if not connected
byte s_spares[6]; // not used for tcp/ip connections
};

len

Pointer to the length of sockaddr. A NULL pointer can be used to represent the sizeof(struct sockaddr). BSDNAME.LIB will assume 14 bytes if a NULL pointer is passed.

Return Value

 0: Success.
-1: Failure.

Library

BSDNAME.LIB

See Also

getpeername


TCP/IP Manual
Vol 1
<<Previous | Index | Next>> rabbit.com