getpeername()

Last-modified: 2006-12-10 (日) 01:51:04

接続している相手のアドレスを取得


int PASCAL FAR getpeername(
SOCKET s,
struct sockaddr FAR * name,
int FAR * namelen
);


s

  • A descriptor identifying a connected socket.

name

  • The structure which is to receive the name of the peer.

namelen

  • A pointer to the size of the name structure.

返り値

成功時は 0 を返しエラーの場合は SOCKET_ERROR を返す

エラー

WSAENOTINITIALISED

  • A successful WSAStartup() must occur before using this API.

WSAENETDOWN

  • The Windows Sockets implementation has detected that the network subsystem has failed.

WSAEFAULT

  • The namelen argument is not large enough.

WSAEINPROGRESS

  • A blocking Windows Sockets call is in progress.

WSAENOTCONN

  • The socket is not connected.

WSAENOTSOCK

  • The descriptor is not a socket.