Reputation: 7620
I am working on both udp/tcp based P2P for file and real time video streaming application.the application will be developed for both Linux and windows platform using c++.
We are using ICE(TCP/UDP hole punching) to implement the P2P. while TCP ensure the packet loss but for UDP I need a decent approach to make sure packet must be delivered to the other peer.
Any link and suggestion will be appreciated?
Upvotes: 1
Views: 6576
Reputation: 7924
A simple approach would be to have a monitoring thread for each packet --
public void run() {
int transmissions = 0;
do {
sendPacket();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
} while (!acknowledged() && ++transmissions < MAX_TRANSMISSIONS);
}
If performance is important, a single thread could be used to monitor a queue of messages.
Upvotes: -1
Reputation: 21616
You might find the answers to this question helpful: What do you use when you need reliable UDP?
Upvotes: 0
Reputation: 59586
You need to cover for 4 main issues:
There is a protocol called slicing window which you could implement. I don't think you'll find a 3rd party library for this (though someone may prove me wrong here), because all the above is typically implemented by TCP itself.
Upvotes: 5