Open motmot80 opened 1 year ago
F.e access to
KcpClient.socket.LocalEndpoint
After patching this to get the client port I also found out, that there's no way to set custom socket options for the server side. I had to patch CreateServerSocket
to make it possible to send udp hole punching events from the same server port to the clients while the server ist already bound to the socket (running/listening):
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
Now udp-hole-punching works like a charm.
* KCPTransport.client.socket.LocalEndPoint.Port
** KCPTransport.server.socket.SetSocketOption
Hello, Thank you for this feature request, I am interested in UDP hole punching too. Do you use your own relay server or an existing service? Best
Description
I need to know the client udp port which is randomly assigned to the socket, so I can use it to punch a UDP hole from the server to the client (f.e. Full-cone NAT).
SERVER:7777 =UDP-PUNCH=> CLIENT:<RANDOM>
Without access to the udp client port (socket port) I cannot punch these holes during the connection phase.
Feature request
Public method to access the assigned client udp port.
You did great work!
Thanks in advance and best regards, Thomas