This function is used to obtain the peer's socket address
information on a connected socket. The function is defined as
int getpeername(
SOCKET s,
struct sockaddr FAR* name,
int FAR* namelen
);
The first parameter is the socket for the connection; the last two parameters are a pointer to a SOCKADDR structure of the underlying protocol type and its length. For datagram sockets, this function returns the address passed to a connect call; however, it will not return the address passed to a sendto or WSASendTo call.
From:Network Programming for Microsoft Windows 2nd.CHM
本文介绍了一个用于获取已连接套接字的对等方地址信息的函数getpeername()。该函数接收套接字及一个指向SOCKADDR结构的指针作为参数,并返回对端地址信息。对于数据报套接字,该函数返回的是connect调用中传递的地址。
1212

被折叠的 条评论
为什么被折叠?



