看了一下 RakNet 3.009 b 版本
里面有个 NatPunchthrough例子
其中 (S)ender 和(R)ecipient, 通过(F)acilitator 已经连接上了,现在的问题是
如何让 Sender 和 (R)ecipient通讯,我使用了一下语句
rakPeer->Send(szMsg,(const int) strlen(szMsg)+1,HIGH_PRIORITY, RELIABLE_ORDERED, 0, reciveAddress, false);
但是发现对方不能收到信息,请问为什么?望各位知道的高手拔刀相助 if (kbhit())
{
char ch=getch();
if (ch=='c' && (mode[0]=='s' || mode[0]=='S'))
{
//printf("Enter recipient IP: "); 
//gets(recipientIP);
//if (recipientIP[0]==0)
// strcpy(recipientIP, "127.0.0.1");
// Connect to the recipient by going through the facilitator, which for the purposes of this sample we can
// assume is the first system connected (GetSystemAddressFromIndex(0))

strcpy(recipientIP, IP_Reciver);
printf("connect recipient IP ");
natPunchthrough.Connect(recipientIP, 60064, 0, 0, rakPeer->GetSystemAddressFromIndex(0));
printf("Attempting connection.\n");
}
else if (ch=='q')
break;
else 
{
if(mode[0]=='s' || mode[0]=='S')
{
char szMsg[256];
printf("Enter you wand send message: "); 
gets(szMsg);
SystemAddress reciveAddress;
reciveAddress.port=60064;
reciveAddress.SetBinaryAddress(IP_Reciver);
printf("Send Reciver %s",reciveAddress.ToString());
bool bRet = rakPeer->Send(szMsg,(const int) strlen(szMsg)+1,HIGH_PRIORITY, RELIABLE_ORDERED, 0, reciveAddress, false); }
}
}