0

I am writing a program for video transmission - it uses OpenCV for splitting video into frames and then sends them via UDP.

Problem is - when I send I get different results - sometimes only few frames are sent, sometimes they are corrupted. It is weird because I am sending to localhost (127.0.0.1) and there should not be any data loss.

I am sending frames by chuncks, size of each chunk is 10240 bytes.

I also use Winsock 2 with blocking sockets.

What can be a root cause of this problem?

Matteo Italia
  • 123,740
  • 17
  • 206
  • 299
unresolved_external
  • 1,930
  • 5
  • 30
  • 65

2 Answers2

1

You are aware that the U in UDP stands for unreliable, yes? No, not really, but it's a good way to remember that the protocol doesn't guarantee delivery.

If you need guaranteed delivery, you should be using TCP.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
0

The first few results from https://www.google.com/search?q=udp+localhost+packet+loss suggest you can lose packets even when sending to localhost.

ChrisW
  • 54,973
  • 13
  • 116
  • 224