3

I know its pretty silly question but I am not able to get it done.

I have a simple chat service. 2 java programs. One is client.java and other is server.java. It is developed using sockets. Now I tested it. It works perfectly well in the localhost.

I have created windows server 2012 EC2 instance on AWS and run my server.java through command prompt in window server. But when I am trying to connect to it from my machine via client.java, I am not able to connect to it.

What might be the reason?

1

1 Answer 1

2

AWS instances are usually not accessible from the outside. They are protected by an internal firewall and have private IP addresses. There is a "public" interface but this won't expose any port other than ssh or windows 53 remote access.

In brief: go to management console:

  1. Go to "Elastic IP", get yourself an "elastic IP" and assign that to your instance. This is the IP address, by which you may reach your instance.
  2. Go to "Security Groups". Add a new group or take the default. Add a rule, opening the port of your java application to the public. Don't forget to assign that group to your instance, once you have created a new group.

That should do the trick ...

Sign up to request clarification or add additional context in comments.

1 Comment

I will definitely try this. Thanks. If it solves my problem, I will accept the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.