我想得到OnReceive()时,那台客户机的IP,听说可以用GetPeerName()
不知道哪位能否帮我讲讲具体用法

解决方案 »

  1.   

    我查过MSDN里面是这样介绍这二个的
    int getpeername (
      SOCKET s,                    
      struct sockaddr FAR*  name,  
      int FAR*  namelen            
    );CAsyncSocket::GetPeerName
    BOOL GetPeerName( CString& rPeerAddress, UINT& rPeerPort );
    BOOL GetPeerName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );
    Return Value我想在
    void CDlg::OnReceive(CClientsocket *psocket)
    {
      getpeername(psocket....)这参数怎么写?或变量怎么定义
    }
      

  2.   

    int getpeername(
      SOCKET s,                    
      struct sockaddr FAR *name,  
      int FAR *namelen            
    );s  Descriptor identifying a connected socket.
    name 
    [out] The structure that receives the name of the peer. 
    namelen 
    [in/out] Pointer to the size of the name structure. 
      

  3.   

    CAsyncSocket::GetPeerName具体得怎么用,怎么进行错误判断
    很急,请高手帮忙
    UP