Simple TCP server and client communication via public ip - sockets

Am using Netgear dgn1000 router and just planning to execute a server-client program over internet.
I switched off windows firewall. Allowed DMZ in router. Also Disabled antivirus in both the system. I don't know what else i got to do.?Please do help

Have you enabled port forwarding to the PC that the server is running on?

Related

How can I make my Socket server to work on WAN?

I am creating a multiplayer game using Unity Game Engine. I created my server using Socket in C#.
My server works fine on the LAN, however it doesn't work on the WAN. I learned that I need to configure port forwarding in order to make it work on the WAN. I am using a Tp-Link router, and I found a great video that helped me to setup port forwarding:
https://www.youtube.com/watch?v=2tIUts0fyFk
Things I adjusted on my own:
In the video, the person used HTTP, but I chose DNS for my Socket server. I don't really know what I should choose here.
On the client side, I changed the server IP from the IP reported by ipconfig to my router's static IP, and the server port to the port I chose while setting up port forwarding.
On the server side, I put the IP reported by ipconfig as the server IP. This is the same IP I chose as my DHCP OPTION.
I am using the UDP protocol for my game, and as I said it is working fine in my LAN network.
My problem is, even after all this, my game is not working on the WAN. I also made sure that my WAN client has his Windows Defender firewall turned off. It didn't work.

How to set up a client/server connection using port forwarding

I created a multi-threaded client/server application that can send messages to each other at real time. Everything works perfectly, but I want to be able to send messages over the Internet. From what I understand, I need to do port forwarding to be able to make my server reachable for the clients. I then set up my port forwarding options by providing a port (9991) and then my Macbook Air's IP Address (192.168.0.1).
I then tried to connect to my server using my public server IP (let's say 197.132.20.222) and it didn't work. I then tried to see if the port forwarding worked by using this website: https://www.yougetsignal.com/tools/open-ports/ and I realized that the connection was closed. I also tried the command nc -vz 197.132.20.222 9991 while running my application and the connection is refused.
I'm using a JavaFX application, and for my server side I use a ServerSocket with port 9991. For the client side, I use a Socket and set the IP Address to my public router IP Address, and I tried to connect with another PC using mobile data to use a different network.
My firewall settings are turn off, so I really don't know what is blocking my application to connect to that port. Could it be my ISP is blocking connections? I just don't understand why my ports are blocked even with no firewalls enabled.

How to setup CentOS port forwarding on a VPS?

I bought a VPS for my game since I was developing and hosting it on my own network. I would simple do port forwarding between my router and my machine, making the config on the router's page. Now, I don't know how to do the same thing on the VPS (SSH). I read something about iptables but Idk if it is what I'm searching for. I just want to open an UDP port. There was Apache running fine and I stopped it. What commands should I use?
I was able to fix this problem. I just shouldn't do any port forwarding, and bind the socket on the public address.

Unable to access jetty server with local IP address

I have configured jetty-maven-plugin in my eclipse Mars and I can run the server using jetty start and stop goals. I can able to access the website using http://localhost:8080/myapp but not using local IP address(i.e., http://192.168.0.5:8080/myapp) from my own computer or other computers connected in the same network via LAN and Wi-Fi.
As mentioned as a solution in these posts,
how to make jetty server accessible from LAN?
Configuring Jetty to accept connections from all hosts
I configured the server host to 0.0.0.0 from localhost to listen on all hosts. With this setting I can see on server start log,
INFO:oejs.AbstractConnector:Started SelectChannelConnector#0.0.0.0:8080
and it works only on http://localhost:8080 but it's not accessible from http://192.168.0.5:8080.
I also tried running that if the interface is accessible using the Networks Interface Listing as mentioned in this comment. and I got,
Display name: NETGEAR WNA1000M N150 Wireless USB Micro Adapter
Name: wlan4
InetAddress: /192.168.0.5
I also tried turning off my Windows Firewall/antivirus but din't help. My jetty version is <jetty.version>9.3.0.M1</jetty.version> and JDK 1.7. What could be the problem? Any help is appreciated.
McAfee Endpoint Security was the culprit here. It was blocking the requests with IP addresses from my very own computer. Turned off the firewall inside the Antivirus and I was able to access the site with http://192.168.0.5:8080/mysite from the browser and other devices connected through the network.
Sometimes some other program opens your port on external address before you do that with Jetty. It will receive all traffic instead. On Windows you will not know it if you reuse port (that is Jetty's default behavior). Check with netstat -ano what is the IP of the process that is indeed listening on 0.0.0.0:8080. Verify if it is your Jetty process only.
Then try connecting with telnet or netcat and see if you can open the connection and what is the response.

TCP/IP using Socket Test 3.0 software

I have 'Socket test v-3.0' software installed on two different PCs.
Using it can create a TCP server on 1st PC and a TCP client on 2nd PC.
When I connect both the PCs on LAN I can establish a connection & can communicate between the Server & Client.
But, When I connect both the PCs to individual Internet connections (Using dongles having different ISPs), I couldn't establish the connection between the Server & Client.
How can I do that?
Please help me out..
The private address 192.168.x.x is address that can be used for direct connection only in your private network. If you want to connect to your machine from public internet you have two options:
Get a public IP address
Configure a port forwarding
Public IP address could be get from your internet provider but it is usually requires some extra payment dependent on your service provider policy.
Port forwarding can be configured at the device at the border between your private network and internet. The device does the NAT (network address translation) between your private network and intenet. Use google if you are not sure about NAT.
Such a device can be your own device like an ADSL modem or a set top box. But such a device could be in the internet provider network. If you own the device then you can configure the port forwarding yourself. Modems usually have a web interface where you can easily configure port forwarding. See the documentation to your modem or whatever you have.
If the NAT device is in internet provider network then you have to ask it to configure port forwarding for you. Before you ask please read something about port forwarding so you are sure what you want to configure.