While developing multihomed reliable udp, how can I detect that a link is down using mininet?

528 Views Asked by At

Here is the topology:

      -----s0---s1-----
 h1 --|               |--h2
      -----s2---s3-----

h1 pumps a file to h2 using UDP in a reliable way. The link between s0 and s1 may be down. Then it should continue to send the data using only the bottom path. Is there a way to detect that the link is down?

So far I created two python sockets in h1 and two in h2 for each path. Using select.select I can get the ready socket to read ack's. If timeout occurs I can retransmit. However, when the link is down, I cannot know that it is down.

1

There are 1 best solutions below

5
James Mills On

If you had to do this from scratch for your implementation for whatever reason;

Try to ping the otherwise, wait for an ack; timeout if you don't receive an ack within a time period; try the other path. Any reason you aren't using TCP? Implementing reliability atop UDP is basically what TCP is over IP.

See The 3-way handshake for an illustration and guide on how TCP handshakes are established.


You could also consider using SCTP which is multihomed, stream based transmission control protocol. Quite a few platforms support it including Linux, BSD, Windows and others.

There is also a Python SCTP lirbary

It's as simple as:

import socket
import sctp

sk = sctpsocket_tcp(socket.AF_INET)
sk.connect("10.0.1.1")

And implements most of the same interfaces as socket