how to use Relay to connect peers which are unreachable. (General questions)
thank you for replying, i tried to use the VPNRelay and succeed to connect, but i'd like to use the TCPHandler and the Relay Server to make the connection between peers and server more stable. i checked some document about TCHandler and as my understanding, i write code like this(fake code):
m_tcpHandler = m_VPN.GetTCPHandler();
m_tcpHandler.put_RemoteTCPHost("xxx.xxx.xxx.xxx");//a public relay server's ip
m_tcpHandler.put_RemoteTCPPort(800); //a public relay server's port
m_tcpHandler.put_LocalUDPPort( 8001 );
m_tcpHandler.put_LocalTCPPort( 8002 );
m_wodVPN.Start("myId", "myPass");
m_tcpHandler.Connect("remoteId");
// then wait for OnTCPConnected event.
void OnTCPConnected(LPCTSTR szRemoteId)
{
if(szRemoteId!=NULL)
{
m_wodVPN.Connect("127.0.0.1", 8001);
}
}
is this correct? i m confused about the m_wodVPN.Connect, should i use the local ip and 8001(the LocalUDPPort of tcpHandler), this code i run, the TCPRelay server( from source code project TcpRelay) prints that "Found match for myId ==> remoteId", but the m_wodVPN.Connect seems not succeed, because after few seconds, the Disconnect event of wodVPN fired. i didn't know what's the problem, can you help to describe some sequence of using the tcphandler, like when can i call the connect of tcphandler and when can i call the wodVPN.Connect?
i really need to use the server to handle some situation of the peers cannot reach each other, thank you!
Complete thread:
- how to use Relay to connect peers which are unreachable. - ardar, 2016-05-18, 05:54
- how to use Relay to connect peers which are unreachable. - Jasmine, 2016-05-18, 16:12
- how to use Relay to connect peers which are unreachable. - ardar, 2016-05-19, 04:38
- how to use Relay to connect peers which are unreachable. - Jasmine, 2016-05-19, 17:28
- how to use Relay to connect peers which are unreachable. - ardar, 2016-05-19, 22:40
- how to use Relay to connect peers which are unreachable. - Jasmine, 2016-05-22, 01:03
- how to use Relay to connect peers which are unreachable. - ardar, 2016-05-19, 22:40
- how to use Relay to connect peers which are unreachable. - Jasmine, 2016-05-19, 17:28
- how to use Relay to connect peers which are unreachable. - ardar, 2016-05-19, 04:38
- how to use Relay to connect peers which are unreachable. - Jasmine, 2016-05-18, 16:12