How to forward ports automatically in java server [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
My question is how can I forward a port automatically in a server.
If anyone knows the game "Minecraft" the user have an option to create a server so anyone can join.
Now what I didn't get is how the server automatically forward the port.
Currently i do not have any code to show.
Thanks In advance.

What minecraft does is creates a local port that is listening for connections. I think what you are asking though is how does the other user get through your router to your server. The answer to that is it uses UPnP to tell your router what ports to forward from the wider Internet.
If you want to implement something similar, look for UPnP libraries for Java or whatever language you are writing in.

Related

Internet IP acquisition when connected to router [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
This post was edited and submitted for review last year and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I want to get the internet(public) ip address and use it in my java app. When I use "ipconfig" or "netstat" (shell commands) or InetAddress.getLocalHost() or even NetworkInterface.getNetworkInterfaces() the router(system) doesn't return the internet ip, instead returns the local address.
However when I connect to router config page using a browser the internet ip address is shown there.
How can I get the internet ip address in my java app?
If your router supports TR-064 there might be a chance to obtiain the public INET address assuming the vendor supports this query.

How does netty server supports both Http and Https protocols with a single port? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
As we know,we provide http service listenning at 80 port,https service listenning at 443 port. Why don't we provide two services on one port? What is the specific reason? And how does netty server supports both Http and Https protocols with a single port?
You can do this but I think its a bad idea as both ports are well defined for either http or https. That said if you really want to do this you can detect if SSL is used or not based on the first 5 bytes of a message and then inject the SSL handler on the fly.
Netty itself includes OptionalSslHandler which does exactly this for you:
https://github.com/netty/netty/blob/netty-4.1.32.Final/handler/src/main/java/io/netty/handler/ssl/OptionalSslHandler.java

How can I run a pure java server on AWS? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have registered to the free AWS plan, and I wish to run a pure java server code I have written on this machine, so I will be able to take this server's IP and use it to connect with my client.
After some searching in AWS I have found many products and features, but I still don't understand how to perform this simple task.
Create a new EC2 Instance SSH into it, install java and prerequisites.
Ensure -
Your Security Group is opened for port 22 for external internet - 0.0.0.0/0 ( or at least your IP )
Use t2.micro instance size - only that is covered under the free tier
Remember to save / store your keypair safely
Check the below links
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance_linux.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-connect-to-instance-linux.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-add-volume-to-instance.html
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-clean-up-your-instance.html

How can the client receive "pong" from server if it has no forwarded ports [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
It might be a weird question but my doubt is the following: If i need to manually forward a port to make my server listen to it, lets say port 123 so that a client can send information to it -using a random port- , lets say 321, how is the server able to respond back to that client in a way that the client receives the answer through that random port 321 if that port wasnt manually forwarded, unlike 123?
A router tracks the outgoing connection and will forward an incoming packet to the sending port when it sees a packet matching the signature.

Block remote access by Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I can connect to the Linux server i have using Putty(i have got IP, username and password). I have got java program in there, started by bat file. I would like to break existing connection and block future connections by putty, after starting the java program. Any idea if thats even possible?
You could edit your script to run the Java program with nohup to make sure the process keeps running after you log out and then kill the ssh daemon after it's been started (man page for nohup).
I don't know of a way of doing this programatically in Java, at least not in a platform independent way.

Categories

Resources