TCP Network commands and Ports (Hole punching)

Just starting out? Need help? Post your questions and find answers here.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

TCP Network commands and Ports (Hole punching)

Post by AndyMK »

Hi all, I have had a lot of experience with Blitz using its UDP functions to traverse NAT compliant routers without the need to open ports. Anyone who knows about "UDP Hole Punching" will agree it makes life much easier for a client using your network app behind a router. This process is also possible with TCP/IP in much the same way. After looking at the available TCP commands in the 3.98 online manual, my question is, can a Purebasic written server know the clients port number when a client connects? This is an essential part of holepunching. Here is a link for anyone interested in this process.

http://www.brynosaurus.com/pub/net/p2pnat/
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

Yes, see the manual:

Code: Select all

Port = GetClientPort(Client) 
Description

This command should be called after EventClient() and will return the port of the client. The GetClientIP() command is available to get the client IP address. 
And see EventClient() where it is stated that it is used on the Server side.

[ I did not check this but there is a server.pb (and clinet.pb) example]

Jan V.
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Post by AndyMK »

Im at work looking through the command index and the command is not there. Are there many more commands missing from the online documentation?

*EDIT*

Looks like a lot has changed since version 3.98 :) 3.94 sorry

I just looked in my help files and sure enough its there ;)
Last edited by AndyMK on Fri Jul 14, 2006 5:23 pm, edited 2 times in total.
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post by Jan Vooijs »

AndyMK wrote:Im at work looking through the command index and the command is not there. Are there many more commands missing from the online documentation?

*EDIT*

Looks like a lot has changed since version 3.98 :)
And I am at home. Oops did not check for versions BEFORE PB4.0, but i thought it was in there since at least 3.94. I do not have 3.94 on my system so i can not check...

Jan V.

(any source from you're experiments in the near furure?)
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
Joel
User
User
Posts: 24
Joined: Fri May 16, 2008 5:39 pm

Post by Joel »

Has you released your projekt. I´m Interested on the Source Code...
Post Reply