0

The java programme performs entirely as expected using both TCP and UDP over the LAN. However over WAN the UDP side, despite the sockets on both client and server being up and packets being sent and received, achieves, at best, a partial simplex dataflow. Where would be the most fruitful area to look at to determine the cause of this?

bjwg
  • 11
  • 2

2 Answers2

0

you need to handle the send and receive in separate threads or using some kind of asynchronous IO. otherwise your app will run in lock stop over a WAN connection. you don't see it on the LAN because the transfers are so fast.

rbp
  • 1,850
  • 15
  • 28
0

Remember that with UDP, each message is just thrown onto the wire. There is no guarantee that it will make it to the other side, so you must develop algorithms to decide when a packet has been lost and when to repeat it. There is no guarantee that any datagram larger than a total of 576 bytes (including all IP headers) will be allowed through the network, so you must divide up your messages or take steps to detect when larger datagrams are failing. There is no way to know how many datagrams the network can handle at one time, so you must regulate how quickly you send messages and know when to slow down.

A Wide Area Network is simply a more difficult environment: there's more competing traffic, slower links, and less tolerance for large datagrams. So things you can usually get away with on a LAN will lead to more errors on a WAN.

So consider whether or not UDP is really the right protocol to be using.

Seth Noble
  • 3,233
  • 19
  • 31