Skip to content

Latest commit

 

History

History

rdt

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

RDT

a Reliable Data Transfer protocol.

Example

Server

packetConn, err := net.ListenPacket("udp", "192.168.3.99:22334")
if err != nil {
    panic(err)
}
listener, err := rdt.Listen(packetConn)
if err != nil {
    panic(err)
}

for {
    conn, err := listener.Accept()
    if err != nil {
        panic(err)
    }
    handle(conn)
}

Client

packetConn, err := net.ListenPacket("udp", "192.168.3.98:22335")
if err != nil {
    panic(err)
}
listener, err := rdt.Listen(packetConn)
if err != nil {
    panic(err)
}

conn, err := listener.OpenStream(&net.UDPAddr{
    IP:   net.ParseIP("192.168.3.99"),
    Port: 22334,
})
if err != nil {
    panic(err)
}
...