Ejemplo n.º 1
0
	bool SocketsApi::IsSelfConnect(socket_t sockfd)
	{
	    sockaddr_in_t localaddr = GetLocalAddr(sockfd);
		sockaddr_in_t peeraddr = GetPeerAddr(sockfd);
		return localaddr.sin_port == peeraddr.sin_port
			&& localaddr.sin_addr.s_addr == peeraddr.sin_addr.s_addr;
	}
Ejemplo n.º 2
0
BOOL Frame::DosePeerUseBroadcastAddress()const
{
	const uchar* broadcast_addr = g_myconfig.GetBroadcastAddr();
	const uchar* peer_addr = GetPeerAddr();
	if ( 0 == memcmp(broadcast_addr, peer_addr, 2) )
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}
Ejemplo n.º 3
0
const char *GetTcpInfor(int peerfd)//get tcp information
{
	static char infor[100] = "";
	//store information 		
	SAI Peer = GetPeerAddr(peerfd);//get peerfd addr
	SAI Local = GetLocalAddr(peerfd);//get local addr
	
	snprintf(infor, sizeof infor, "%s:%d -> %s:%d",	
	GetIp(&Local),//get ip
	GetPort(&Local),
	GetIp(&Peer),//get port
	GetPort(&Peer));

	return infor;
}