I'm trying to set up a server that connects to a tcp port, but when I activate the cloudflare proxy, it's not connecting to the port, what could it be?
Test login only with ip and i was successful, also only with domain and i was successful
Related
I am trying to implement NAT hole punching for UDP datagrams for a simple Unity game. I have a public-available server (example.com) which is listening on both TCP and UDP on port 8995.
The idea for algorithm follows:
Client connects on TCP/8995 and specify the details of the game it want to host
Server reply with token
Client starts UDP socket via UdpClient class in C#
Client sends UDP datagram to server from this socket with the token. The server learns NAT Ip/Port of the client
When another client wants to connect, it asks server for the Ip/Port of the client it want to connect
The problem I have is step 4. I setup a client at my PC (192.168.1.1 port 9589) which is behind NAT and send my UDP packet to server. I received it via:
_listener = new UdpClient(_settings.EndPoint);
IPEndPoint source = new IPEndPoint(IPAddress.Any, 0);
var datagram = _listener.Receive(ref source);
_logger.LogDebug("Recevied UDP handshake from {EndPoint}", source);
The log I am getting here is Recevied UDP handshake from x.x.x.x:9589 where x.x.x.x is my correct public IP of the client.
Obviously the port I am getting in the log is not a temporary port on NAT, but a local port of the client behind NAT. So the Peer must have traversed the NAT to learn that (via UPnP maybe?). Is there any way to disable that behavior on server so I can learn the temporary port on NAT?
I am using Net Core 6 and Ubuntu server
Obviously the port I am getting in the log is not a temporary port on NAT, but a local port of the client behind NAT.
You get the port assigned by NAT, not the port used by the client on the LAN. These ports can be the same, because many NAT implementation try to do port preservation if possible.
Why my client can't connect to the server with port 8080. I use vpn to set network lan But port 80 is working fine.
When I connect to site by ip in port 8080. it's return This site can’t be reached The connection was reset.
How can i fix it.
my server is iis7.
I have a rather complex client server app that has three separate UDP connections.
One connection (port 50001) is for control of a device.
This connection listens for connections from a remote device and when a connection is made sends data and receives data. This works fine over a LAN as well as over the internet. Of course, port forwarding is enabled on the server network. This works fine using a mobile phone hot spot as well.
Another connection is for UDP sound being sent from the client to the server (port 50002). In this case, the client just sends UDP packets to the server using the routers internet IP Address which then by port forwarding goes to the server. This works fine over the LAN, and the Internet using a mobile phone hot spot.
Now there is a third connection (port 50003) where the issue comes in.This connection is the client receiving sound from the server. This works if I am on the lan and connect direct to the server or if I specify the Internet address of my router. But it does not work with a hot spot.
So the question is, is this an issue with the Mobile provider that is just not letting the UDP packets in over port 50003? Or, am I not connecting correctly to the hotspot?
So this is how the code works: When the connection is made from the client to the server for control of the device, I get the remote IPEndpoint address and save it. Next I just start sending the UPD packets from the server to the client using this address. Again this works over the LAN direct to the client, but it does not work if I use a hot spot.
Here is the code:
Note:address contains the address of the remote client from the first connection:
private void Connect(string address, int port) //at this point the control connection is running and the address comes from there
{
IPAddress destination = IPAddress.Parse(address)
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
endPoint = new IPEndPoint(destination, port);
}
private void SendBytes(Byte[] bytes)
{
socket.SendTo(bytes, 0 , bytes.,Length, SocketFlags.None, endPoint)
}
So this exact same code works in the direction from client to server but in that case I am sending the UDP packets to the router internet address which has port forwarding enabled. However, it does not work in the direction from server to client. The question is why not?
Is it because a port forward is not available on the hot spot?
Why is one not needed for the control (Connection one??).
I should mention that the control connection is different than both of these: It is an async UDP server.
Thanks
Your assumption that the problem is on the missing port forwarding of the hot spot is correct.
Often the IP addresses provided by the hot spot are from a private range (e.g. 192.168.x.y) and are translated with NA(P)T to the public IP address of the hot spot.
When you send an UDP message from the client to the server, the router in the hot spot keeps the information of the source and targets IP addresses and ports. When an answer is received using the same IPs and ports, this message is forwarded to the client.
But when you use a different port number, the router doesn't know to who this message should be sent.
If possible, I would suggest that the third connection is also initiated by the client or that the data is sent over one of the other two existing connections.
I am trying to make a peer to peer chat program. the scenario is much more complicated but I will simplify it to get help in the the part where its needed.
as a summary:
A- The Server
There is a server waiting for clients to connect, when a client connects it will be kept as waiting till the next client connects.
When the 2nd client connects to the server the server will return to each client the ip and the port of the other client, so both client can talk to each other without intervention of the server.
Then the server back to 1
B- The client
the client start a tcpClient connection with server.
wait the server response.
client receive a custom object that contain the ip and the port of
the other client
start chatting with the other client using the ip:port provided by
the server of the other client.
The question is: is this possible considering network and firewall security configuration (default) on the client machine?
The client might be behind pating or nating router.
The application is going to run on the internet or local network.
Note: the thing i need help is it possible in C# to implemented the client part of the application to act as server and listen to a port and receive connections knowing that the port is not configured on the possible front end router;
Are there alternative solutions? The main idea is to keep the server out of the picture after server step 2
I have a few questions regarding sockets, I searched but couldn't find a direct answer.
I have a login server, and a world server. I connect from the TcpClient to the TcpListener on the login server. I want both a Tcp and a Udp connection on the world server, so once login has been checked, I redirect the TcpClient to the world server using TcpClient.Connect.
After this process, I tell the client to connect via Udp to the login server, and then use Socket.Connect to forward again to the world server.
The reason I'm forwarding and not sending client messages to the client to redirect, is that I only want to expose the login server IP and port to the client.
I'm not experienced with sockets, is there a better way to redirect without exposing the world server IP and port?
You can check the image on this page: http://next-gen.cc/
What you are looking for is a connection server that will maintain one connection to a client socket and keep the state of the client (connected, authenticated, playing, disconnected).
Once the player logs in, the connection server opens its own socket to the right game server and forwards all messages there, also when a game server wants to send the client data it will send it to the connection server which in turn sends it to the client.
In other words, make your login/connection server function as a router between the client and your game world.