<< Previous | Index | Next >>

getpeername


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

Description

Gets the peer's IP address and port information for the specified socket.

Parameters

s

Pointer to the socket.

dest

Pointer to sockaddr to hold the socket information for the remote 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).

Return Value

 0: Success.
-1: Failure.

Library

BSDNAME.LIB

See Also

getsockname


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