I just created a simple chat client and it only works when all clients / server are portforwarded on the same port.
How do i make my application (its in c# and uses .net sockets btw) work without the need of port forwarding for clients (i dont care if server needs to port forward).
it uses udp by the way.
I believe you titled your question wrong. You are talking about the server connecting to the client, right?
If you are working directly with sockets, the short answer is - you can't. The long answer is that the client has to register with server in such a way that the client port is held open so the server can reach it.
Rather than writing this yourself, consider a library that is focused on this, such as SignalR.
Besides - UDP is a horrible choice for a chat client anyway. There are plenty of jokes about UDP packets, but trust me - you won't get them all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With