Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not a networking guy, so I apologize if my question is dumb.

I have two Ubuntu machines setup on Amazon EC2. I need to "talk" from one to the other via port 9300. On my receiving machine, I ran the following from the command-line.

netstat -ntlup | grep 9300

On my client machine, I ran the following from the command-line.

telnet [otherIPAddress] 9300

After entering that command on my client machine, I see the following printed:

Trying [otherIPAddress]...
Connected to [otherIPAddress].
Escape character is '^]'.

Then, I entered 'Hello World' at the command line. Immediately after pressing 'Enter', I see the following:

Connection closed by foreign host.

Why would I get this error? I really need to be able to get this connection running. For the life of me, I can't figure out why I can't communicate over it.

share|improve this question
The fact that you got Connected to [otherIPAddress] means your connection is working. The connection is getting closed because the remote application/service is closing it, most likely from bad input. You should be good to go to begin real conversations on that port. Unless, of course, the remote app/service is really expecting input of "Hello World". – squillman Apr 3 '14 at 18:23
up vote 10 down vote accepted

This appears to be working as expected however, whatever is running on [otherIPAddress]:9300 is not expecting Hello World\n so it dropped the connection.

share|improve this answer
On the machine at [otherIPAddress], I run and get the following: telnet localhost Trying telnet: Unable to connect to remote host: Connection refused – user312840 Apr 3 '14 at 18:27
@user312840: That's becuase whatever is listening on [otherIPAddress]:9300 is not listening on (connection refused generally means nothing is listening on the IP:port combination). – Iain Apr 3 '14 at 18:28
Just because a daemon/service is listening on one interface and port combination does not mean it will respond to localhost connections, or even connections from other interfaces on the same host. Iptables, network settings, or service configurations are all parts of the equation. – 0xSheepdog Apr 3 '14 at 18:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.