how to use Relay to connect peers which are unreachable. (General questions)
i purchased soucecode license and use the WODVPN to connect peers under different network.
in some network environment, the peers cannot reach each others.
i had 3 peers A, B, C (3 PC in 3 diffirent netowrks, all have NAT and router on the gateway)
now after search method, the A can connect to both B and C, and B,C all can connect to A.
but B cannot connect to C, C cannot connect B.
it is confuse, i think if one peer cannot be reached, all peers shouldn't be able to reach it, right?
i just want to confirm is my case is normal or it is unnormal?
then if it is normal, any resolution can make the B and C communicate to each other?
i've tried to set the UseUpnp, but still not working in B and C.
can i use the CVPNRelays to let the both peers connect to a public server first? to make them communicate using the server?
if can, how to use this Relay class?
in what timing i can call to add a CVPNRelays to the WodVpnCom instance.
i'm using VC, and Com version.
can you just give some hints is ok, thank you very much?
how to use Relay to connect peers which are unreachable.
Hi.
It is possible that B and C are unable to connect, for example if both sides uses BSD-alike gateway that doesn't use sequential NAT port allocation. UPNP should help here, or using static ports open on the router.
When this happens, you can always any server with public IP to use as a relay for those peers
http://www.weonlydo.com/VPN/Help/wodVPN-VPNRelay.html
I hope this helps!
Jasmine.
how to use Relay to connect peers which are unreachable.
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!
how to use Relay to connect peers which are unreachable.
Hi.
Your code looks ok, I'm not sure why disconnection occurs.
However, TCPHandler doesn't really help you connect where UDP fails, using UDP relay is much safer solution. TCP is harder to penetrate firewall if both sides are behind NAT, so I would suggest you use UDP relay for this purpose.
Jasmine.
how to use Relay to connect peers which are unreachable.
thank you, i tried to use the VPNRelay, it works but i have confuse about:
1. is one instance of VPNRelay can only serve to one pair of peers? or one VPNRelay can serve to many peers, and peers can identify the target by ID and targetID ? which decided whether i should initial a lot of VPNRelay instances or i can only initial only one instance on the server.
2. one of the privous post here said that you can set the vpnRelay.Password before start the relay, i don't understand how to use the passowrd, it should be the same as the peer's passowrd which is set in calling
wodVPN.Start(myId, password)
? i tried not to set it, the peer also can connect to the relay, so what's the usage of the password?
3. did the relay check the 2 peers's id's matching? or just simple match any two peers which are connected to the same relay at the same time?
thank you
how to use Relay to connect peers which are unreachable.
Hi.
It is one relay per connection. You must implement your own logic for relays, on when to fire up new one, how to notify remotes to connect there etc..
For Password, you should use the same as wodVPN isntances are using - since this is part of control over connected peers.
Kind regards,
Jasmine.