WHY is GetClientPort() giving a Port different...

Everything else that doesn't fall into one of the other PB categories.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

WHY is GetClientPort() giving a Port different...

Post by es_91 »

... from what I set up in CreateNetworkServer() ?

Can somebody answer to this?
:mrgreen:
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 450
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Re: WHY is GetClientPort() giving a Port different...

Post by Didelphodon »

Because it's the port of the client side which is usually a more or less random one. The port you chose for server creation is your local port where clients can connect to.
Go, tell it on the mountains.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: WHY is GetClientPort() giving a Port different...

Post by es_91 »

So there are two ports to a connection, one at the client's side and one at the server's side and PureBasic allows me only to set the one at the server's side, is that right?
:mrgreen:
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: WHY is GetClientPort() giving a Port different...

Post by Shield »

Yes, that's how TCP / UDP work. The client port doesn't mean anything, it's just used
so the server knows what port is expecting the answer.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: WHY is GetClientPort() giving a Port different...

Post by es_91 »

Thanks. :)
:mrgreen:
Post Reply