getpeername

 

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

 

發佈了17 篇原創文章 · 獲贊 3 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章