1

I know some of the probable reasons for this by doing my own R&D but I am still confused.

My application sends a small image of max. 2000Kbs to my server. There it draws this image to my canvas control. I use udp because if i use tcp the image appears 'jumpy' because the tcp does more work than udp and sends a ack back to my client. This is why I use udp. Indeed for this type of scenario i can see it it sometimes recommended to use udp. I am not bothered if all images does not make it to my server you see. Fire and forget is what I need.

This all works well on my own LAN. Recently, I went away (before COVID!) to a remote Welsh cottage. The internet there is not that good. i thought it would be a good idea to stress test my application. The image never arrived at my server. So, playing around, i reduced the quality of the mages so that I was only send on average 1000Kbs for each udp packet. The images started to get through. The quality of the image was not that great but I can live with that.

So, I thought if I could detect poor udp transmission rates on the current LAN I could automatically reduce the image quality of my image. So, I googled this. All I could was that I could check the MTU on that LAN. But it also says you should not extend beyond 512Kbs. But it also says the maximum udp packet can be 65507. But then it says the chances of a udp packet getting though at that size is remote.

So really confused. Like i said I can handle random missed images. But I want to increase the chance of most of the images getting through. If MTU only gives me 512kb to to go by are there any other metrics i can use?

Thanks

Andrew Simpson
  • 6,883
  • 11
  • 79
  • 179
  • _" I use udp because if i use tcp the image appears 'jumpy' because the tcp does more work than udp and sends a ack back to my client"_ this sounds like a bug on your part of presenting the image – Ackdari Jun 08 '20 at 07:45
  • @Ackdari No it is not a bug. The tcp does more work as explained. Thanks – Andrew Simpson Jun 08 '20 at 07:47
  • I know that, but why does it effect how the image is presented? – Ackdari Jun 08 '20 at 07:47
  • @Ackdari perhaps 'jumpy' is the wrong word to use then. perhaps slower rendering , not as fluid/real time etc would suffice. Regardless, my question was not about 'why does my images appear jumpy' when using tcp. I prefer to remain focused on my question rather than focus on using tcp. thanks – Andrew Simpson Jun 08 '20 at 07:49
  • As a proposal: You could use a tcp connection to comunticate how many images you want to send in a given time and how many arrived at the destination. Then if the fraction `recieved/send` goes under a given threashold you could adjust the packed size for the next `x` images send. – Ackdari Jun 08 '20 at 07:51
  • 1
    my proposal was to only use tcp for communicating the number of images and to send the _real_ data use udp – Ackdari Jun 08 '20 at 07:53
  • 65507 is a theoretical limit. In practice you should consider much smaller UDP datagrams. See https://stackoverflow.com/a/1099359/11527076 – prog-fh Jun 08 '20 at 07:56
  • @Ackdari OK, interesting idea and I will give you a +1 for that. I am not sure if there is a correlation between tcp FPS and udp image size. I will have to test, but thanks for the suggestion :) – Andrew Simpson Jun 08 '20 at 07:57
  • @prog-fh thanks but I have read that. I want to know the threshold of the current LAN I am using. That question/answer does not answer my question. It just says to use a smaller packet. The images will look useless if I use 512kb., thanks – Andrew Simpson Jun 08 '20 at 07:58
  • @jdweng excellent! Nice and simple. You should this as an answer. – Andrew Simpson Jun 08 '20 at 08:27

1 Answers1

-1

Every connection has a reliability rate. These day reliability is very high, but still can have issues. TCP is considered reliable because packets have max size of 1500 and every packet get an ACK and when the ACK is not received the packet is resent. So TCP also has a high overhead to handle the ACK. UDP does not have the ACK and is not as reliable as TCP, but on good networks you shouldn't have an issue. So a good method of testing the reliability of a network is to test with ping. Use : ping -t -l 65500 IP where t is ping until stop and l (length) is the length size. – jdweng 11 mins ago

jdweng
  • 33,250
  • 2
  • 15
  • 20
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/215668/discussion-on-answer-by-jdweng-why-do-some-udp-packets-not-get-sent-on-different). – Samuel Liew Jun 10 '20 at 13:14