How to setup a Relay (General questions)
Hi,
Let me explain a little about our problem, we've several users and a virtual private server (with a valid/static IP address), we want to connect to our clients but there is no direct way, so we need to connect through the server, means client should connect to server, we should connect to server and in server these connections paired and exchange data, I'm really confused with the channels, TCPHolder, TCPRelays and I can not find my way,
So would you please kindly show me the best way to implement this,
Thanks,
Hamed
Re: How to setup a Relay
Hi Hamed,
First off, there's no client-server approach with wodVPN. wodVPN is a peer-to-peer component, and connection is *always* established directly.
In other words, you don't actually need a publicly accessible machine. However, if you do have one at disposal, then you can use it to setup a Mediator, which is used to exchange ID's, addresses and ports which will be used by each peer.
As for setting up a relay, all you need to do is use the wodVPN.Relays.Add(some_port_number). When connecting to a relay, you simply set Hostname and Port properties of a relay and call Connect method.
As for the terms you mentioned, let me try clarifying:
1. Channels - used in case you don't want whole network traffic to be redirected to other peer. It's same as Tunneling in SSH.
2. TCPHandler - used when UDP isn't acceptable / is blocked. UDP traffic is then re-routed internally and sent over TCP. However, UDP is still used internally
3. Relay - is set up on some publicly exposed host and used when connection doesn't succeed directly. In that case, both peers connect directly to the exposed host on the specified port. Data is then relayed through the machine that created a relay.
Hope this helps.
Regards,
Damba
Re: How to setup a Relay
Thank you very much for your reply,
So what's your suggestion when 2 peers cannot see each other directly? I was thinking of Relay on our VPS, and then each peer connects to that and then attached together, Is it possible? Due to my low IQ would you please help me with a simple sample or other possible solution for our problem,
Thanks and Regards,
Hamed
Re: How to setup a Relay
Hamed,
Basically this is full code you need to use on some machine to start relay:
[code]Set vpn = New wodVPNCom
vpn.Password = somepassword
vpn.Relays.Add 3003[/code]
both peers should then inside Connect Method use IP of relay and Port (in this case 3003) to connect to other peer over relay.
Can you try something like that and let us know how ti goes? Also, if you didn't already check, we have samples for wodVPN. You can find them inside component Samples folder.
Drazen
Re: How to setup a Relay
Thanks Drazen
Basically this is full code you need to use on some machine to start relay:
[code]Set vpn = New wodVPNCom
vpn.Password = somepassword
vpn.Relays.Add 3003[/code]
both peers should then inside Connect Method use IP of relay and Port (in this case 3003) to connect to other peer over relay.Drazen
It works, relay is prefect but how can I redirect a port from my local computer to the relay port?
I've checked this:
[code]wodVPN1.Channels.Add TCPLocalListen, 127.0.0.1 , 5000 , VpsIP, 3003[/code]
but I've got errors, any idea?
Thanks and regards,
Hamed
Re: How to setup a Relay
Hamed,
Relay should be used only to connect two peers.
Inside Channels.Add you communicate with your other peer. So you should forward there remote peer IP and port and not relay IP and port.
So it's same as you connect directly two peers.
Drazen