Login  
Search All Forums
Dart Home | PowerTCP Winsock for ActiveX | Custom Development Reply | PowerTCP Winsock for ActiveX Topics | Forums   
AuthorForum: PowerTCP Winsock for ActiveX
Topic: P2P UDP Handling
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 8:58 AM

Hi guys..
I have a problem.. i need the programming theory for following probelm:

I will running on a webserver (public ip) a application (server).. client1 (behind NAT) connect to this server (server set the client1 status online) .. client2 (behind NAT or not) connect to server and server set satus online..

now client2 will connect to client1 (via p2p and UDP) ..the server must send to client1 the ip and port from client2 and to client2 the ip and port from client1 (IP and port must are the public ip and ports from the clients).. then the clients begin connect p2p (client1 to client2 and client2 to client1 syncronly)..

any guy can help me?? I need the programming theory (best a sample - but does not have)..
Wich PowerTCP must i have?

Please help me fast :)

best regards

Karl
Alex Gladshtein



From: Rome, NY USA
Posts: 131
Member Since: 12/27/00
posted June 4, 2004 10:40 AM

Hello Karl,

You would probably want to use the Server Tool for building the Server, then have a database that stores information about all the clients on that server. You will need your own protocol for communicating data, which probably doesn't need to be very complicated. The client can be built using the TCP control and the server would use the Server control (unless you have your own client), in which case you will just be using the Server control. As far as specific techniques, that would be more involved and require testing to establish best performance for your situation. You always have the option of contracting us for any R&D that you require. I hope that helps you in deciding what to do.

Regards,

Alex Gladshtein
Product Manager
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 11:31 AM

Thank you very much for the fast reply :)

Ok .. any code sample for the server?? I donīt know how i begin for the server solution :(
Van^

From: Blacksburg, VA USA
Posts: 17
Member Since: 09/04/03
posted June 4, 2004 12:49 PM

I assume you are trying to create an open tunnel so that you can do peer to peer UDP communication between the client1 and client2 even if they are both behind NATs?

-- Dave
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 1:08 PM

I not really sure what you mean.. i think yes.. client1 and client2 are both behind NATs!
Alex Gladshtein



From: Rome, NY USA
Posts: 131
Member Since: 12/27/00
posted June 4, 2004 1:27 PM

Hello Karl,

If you look at the VB6 samples that come with the PowerTCP Server Tool, you will see a number of different sample server applications. Basically, it sounds like you need to accept the connection and record the client IP in the database plus any other info you need. The client may not be able to tell its outside IP, but the server can read where the incoming connection originated. If you need to tell any other client about another IP, then you would just query the database. This is if I am understanding you correctly. Dave may have some input from his experience.
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 1:38 PM

ok thank you.

have any guy a sample will be great...

now i will looking on PowerTcp Server Control for the Solution..

best regards Karl
Van^

From: Blacksburg, VA USA
Posts: 17
Member Since: 09/04/03
posted June 4, 2004 1:39 PM

What I am gathering you are trying to do is to establish a unique peer to peer connection between two clients behind different NATs. I have actually done this using UDP. It is possible to do it with TCP, but extremely unreliable.

In any case, you will need a central server which both clients connect to with TCP. That server will also accept UDP packets from each client. Upon receipt of those UDP packets, the opposing client is informed of the port and IP address that the server perceives the data is arriving from (the server tells client1 over the TCP connection what the IP and port it thinks client2 is sending its UDP packets from and vice versa.) At this point, both clients try to send to each other on those ports.

If everything goes as planned, a stable P2P session is now available between the two clients. You will want to look at the Simple Traversal of UDP Through NAT protocol (STUN). Do a search on google for this and you will find several whitepapers that have been written about this and about the different kind of NATs that exist. You will have to make several considerations in your process depending on what kind of NATs are present.
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 1:51 PM

Thank you very much.. thats it!

i have read this whitepapers (p2p and the "hole punching")

If a sample possible from any guy will be great ;)
Van^

From: Blacksburg, VA USA
Posts: 17
Member Since: 09/04/03
posted June 4, 2004 1:55 PM

Unfortunately, I wouldn't be able to provide direct samples, as my code is confidential to my company. It's fairly straightforward, however. You will just need to write a small server with a TCP daemon and a UDP port and a couple of client objects (one for the TCP connection and one for the UDP)

After that, just follow the process outlined in the papers.

-- Dave
karl

From: berlin, USA
Posts: 10
Member Since: 06/04/04
posted June 4, 2004 2:03 PM

ahh great.. also i must connect to the server via tcp (not udp)? and after client1 and client2 have the ip and port from the other client then i must make a udp connection (not tcp) from client to client?
Van^

From: Blacksburg, VA USA
Posts: 17
Member Since: 09/04/03
posted June 4, 2004 3:00 PM

You'll want TCP connections to the server from both clients. Then each client will send the server some UDP packets. The server will analyze those packets and tell the opposite client (over TCP) the information about the UDP packets received.

-- Dave
Reply | PowerTCP Winsock for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX