Jump to content
  • Advertisement
Sign in to follow this  
MrDarkKnight

Client keep changing port UDP !

This topic is 2547 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone

First of all this is my first post and I'm so very happy that I joined this forum and I hope I can help other and others help me :D

anyways, I'm making a server and a client using UDP and Winsock in c++. I have a small problem where the server is in a infinite while loop where the server keep receiving data. The client send only one message and closes. I noticed that every time i open the client the server show that the client changed his port number ! even though the client and server are on the same PC. Why?!!
I set the port number in my server and client to 27015 but the server show that the message that was sent from the client has a port of 51419. and everytime the client sends a message to the server the port changes. Why?!
How can I keep track of the clients data if the port changes everytime the client sends a message or data?

Share this post


Link to post
Share on other sites
Advertisement

Hi everyone

First of all this is my first post and I'm so very happy that I joined this forum and I hope I can help other and others help me :D

anyways, I'm making a server and a client using UDP and Winsock in c++. I have a small problem where the server is in a infinite while loop where the server keep receiving data. The client send only one message and closes. I noticed that every time i open the client the server show that the client changed his port number ! even though the client and server are on the same PC. Why?!!
I set the port number in my server and client to 27015 but the server show that the message that was sent from the client has a port of 51419. and everytime the client sends a message to the server the port changes. Why?!
How can I keep track of the clients data if the port changes everytime the client sends a message or data?


Don't close the socket between sends. (If you need to track clients between sessions you have to use a login system of some sort)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!