Jump to content
  • Advertisement
Sign in to follow this  
Core2Duo

Inquiry using UDP over the internet

This topic is 3660 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

Hello all, I'm new here. I'm currently working on a project that supports both TCP and UDP protocol, I just have some inquiry regarding using a UDP over the internet. While using a TCP connection whether it's a raw Socket/TcpClient on the client side "I Can Send and Receive" messages from the remote server over the internet without tweeking anything on client's machine. On the other hand while using UDP protocol, the client side "Can only Send messages" to remote server over the internet, but "Cannot Receive messages" from the server. Is this a fact on using UDP on the client side, do I still need to open the port from the routers menu on client's side, unlike using TCP I don't need to tweek anything on client's machine but works fine. Any enlightentment to the subject would be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
while using UDP protocol, the client side "Can only Send messages" to remote server over the internet, but "Cannot Receive messages" from the server


If the server uses recvfrom() to receive the data, and sends the response using sendto(), then the client should receive that response.

In general, if the client initiates a packet stream over UDP, then the NAT software in the router will make sure that any reply packets will get back to the client.

If that doesn't work, and you're sure you don't have a bug in your code (such as listening on the wrong socket, or trying to open multiple sockets/ports, etc), then the problem is likely with the firewall/router on the client end.

Share this post


Link to post
Share on other sites

Quote:
Original post by hplus0603
In general, if the client initiates a packet stream over UDP, then the NAT software in the router will make sure that any reply packets will get back to the client.


Ah, There it is - This is something to keep in mind.


After reading the above help, I have a feeling it's a bug in my code, since I'm
using multiple UDP sockets for my UdpListener, UdpReceiver and UdpSender.

Many thanks, your help is very much appreciated.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!