i'm using the UDT library to transfer files beetween to computers behind NAT. I already did a hole punching protocol in python and i know how it works. Here, i'm trying to bind an UDT socket to an existing UDP socket.
int udt_holepunching(SOCKET sock, SOCKADDR_IN sin, int size, SOCKADDR_IN peeraddr)
{
UDTSOCKET u;
bool rdv = true;
UDT::setsockopt(u, 0, UDT_RENDEZVOUS, &rdv, sizeof(bool));
UDT::bind(u, sock);
UDT::connect(u, &peeraddr, sizeof(peeraddr));
}
with sock
my existing UDP socket
and peeraddr
the adress of the computer that i want to talk
i have this error :
client.cpp: In function ‘int udt_holepunching(SOCKET, SOCKADDR_IN, int, SOCKADDR_IN)’:
client.cpp:29:20: error: invalid conversion from ‘SOCKET {aka int}’ to ‘const sockaddr*’ [-fpermissive]
UDT::bind(u, sock);
^
client.cpp:29:20: error: too few arguments to function ‘int UDT::bind(UDTSOCKET, const sockaddr*, int)’
In file included from client.cpp:13:0:
../src/udt.h:315:13: note: declared here
UDT_API int bind(UDTSOCKET u, const struct sockaddr* name, int namelen);
It's kind of strange because in the UDT bind documentation, it seems to be possible.