Tcp connection to Linux server fails

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Tcp connection to Linux server fails
# 1  
Old 03-11-2014
Question Tcp connection to Linux server fails

I am trying to send json messages to a port on a linux server from a remote server running a .net program. I have one implementation running with successful incoming messages to port 1514. I tried to replicate the same thing but just to another port but cannot get it to work as I get the following error:

No connection could be made because the target machine actively refused it

I tried a few things I found online. I checked the firewall settings and there were no restrictions. I then added a line to accept incoming connections but this did not help. I have a logstash installation to which I am sending these messages. I cannot recall what I did in the initial installation and if I specifically set up the port to listen. I would appreciate any ideas on how to diagnose and solve this issue.

ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether ae:47:38:41:b8:3b brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet6 xxxx::xxxx:xxxx:xxxx:xxxx/64 scope link
       valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit brd

iptables -vL

Chain INPUT (policy ACCEPT 193K packets, 13M bytes)
 pkts bytes target     prot opt in     out     source               destination
7707K 4545M ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED
    3   152 ACCEPT     tcp  --  any    any     anywhere             anywhere            state NEW tcp dpt:ncube-lm

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 7521K packets, 6906M bytes)
 pkts bytes target     prot opt in     out     source               destination

netstat -nlptu

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name 
tcp        0      0     *                   LISTEN      1337/snmpd       
tcp        0      0   *                   LISTEN      1616/monitor (Texis
tcp        0      0        *                   LISTEN      1378/vsftpd      
tcp        0      0        *                   LISTEN      1350/sshd        
tcp        0      0 :::1514                     :::*                        LISTEN      4175/java        
tcp        0      0 :::9292                     :::*                        LISTEN      4175/java        
tcp        0      0 :::9200                     :::*                        LISTEN      2477/java        
tcp        0      0 :::9201                     :::*                        LISTEN      3928/java        
tcp        0      0 :::9202                     :::*                        LISTEN      4175/java        
tcp        0      0 :::9300                     :::*                        LISTEN      2477/java        
tcp        0      0 :::9301                     :::*                        LISTEN      3928/java        
tcp        0      0 :::9302                     :::*                        LISTEN      4175/java        
tcp        0      0 :::22                       :::*                        LISTEN      1350/sshd        
tcp        0      0 :::9303                     :::*                        LISTEN      4175/java

Is this a logstash configuration issue or linux network setting?
# 2  
Old 03-11-2014
To be honest i do not know your application, but:
Originally Posted by unienewbie
No connection could be made because the target machine actively refused it
this looks like you have to do some configuration work in your application. For a host to open a connection it has to have a daemon running which is listening to the port where the connection is attempted.

For instance: let's say you contact a web server. This means your browser creates a message, sends it to the target server, port 80 (or whatever is configured, but 80 is the default). Behind port 80 on the target server lurks the web server process (Apache, ...), which picks the message up, does something and sends a message back (like: serves up a web page). If the web server would not listen behind port 80, nothing would happen at all - the host would "refuse the connection".

This is why i think you simply have nobody listening behind port 1521, so that no connection comes to pass.

I hope this helps.

# 3  
Old 03-11-2014

Thank you so much for your response and the great explanation. I understand now that basically it means that my server side application needs to be listening on that port that I am connecting to.
# 4  
Old 03-11-2014
Exactly, and you should not choose a port listening to your feelings but check in /etc/services if that port is not reserved by someone... then it turn you should update /etc/services once you affected ports so others know what you are using...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sendmail Fails to send emails from Linux server.

I m using free zoho mail client application (similar to microsoft outlook) on my mobile for all my emails to I wish to only recieve emails from my Linux Server details of which are: techx 3.10.0-514.10.2.el7.x86_64 #1 SMP CentOS release 7.3.1611 (Core). I try the below... (20 Replies)
Discussion started by: mohtashims
20 Replies

2. Solaris

Tcp Socket (Connection refused) to my server box

I installed a fresh copy of Solaris 7 and present up my ip and domain for my web services but when I try to connect to it I get the following error; TCPActiveOpen: connect failed tcp/ 146 (Connection refused). the port is open in my router but I don't no were to add it in... (5 Replies)
Discussion started by: Wpgn
5 Replies

3. Solaris

Too much TCP retransmitted and TCP duplicate on server Oracle Solaris 10

I have problem with oracle solaris 10 running on oracle sparc T4-2 server. Os information: 5.10 Generic_150400-03 sun4v sparc sun4v Output from tcpstat.d script TCP bytes: out outRetrans in inDup inUnorder 6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies

4. Emergency UNIX and Linux Support

Ssh connection from Sun OS to Linux server

Hello, I ahve written a shell script which is doing ssh from UNIX Sun Os to multiple Linux servers one by one using loop. but after first iteration the script is getting exit. Rather it should connect to other linux server as well one by one. Please refer belwo code. #!/bin/ksh #set -x... (2 Replies)
Discussion started by: skhichi
2 Replies

5. Programming

TCP connection check

Hi. I am writing client - server application using TCP sockets. I need some very basic functionality, namely: how to check if another "participant" of the connection is still present? I want to handle situations, when client is gone, or server breaks down, etc. (25 Replies)
Discussion started by: Shang
25 Replies

6. IP Networking

false tcp connection

Why this happens? How to solve this? $netstat -na |grep 9325 tcp 0 0 ESTABLISHED When a client socket repeatedly tries to connect to an inactive(no server socket is listening on this port) local port,connect succeeds. ... (1 Reply)
Discussion started by: johnbach
1 Replies

7. UNIX for Dummies Questions & Answers

Server fails to allow connection

Hi, I use bru to backup a variety of servers. One of our servers crashed and we had to do an emergency restore. It is working fine. The problem is the backup server refuses to backup the ftp server. The backup server ssh's into the servers and executed the bru command and instructs that that... (1 Reply)
Discussion started by: mojoman
1 Replies

8. Shell Programming and Scripting

Create a TCP/IP Connection

Hello, I am trying to write a script in Perl which will send some data from a UNIX Box to a windows box. I am planning to create a TCP/IP communication port for the same. How do I go about this? Kindly help. Regards, Garric (50 Replies)
Discussion started by: garric
50 Replies

9. UNIX for Advanced & Expert Users

about TCP connection

Hi Experts, need help about release or refresh TCP Connection: i have the sample like below : application log connection: 0500 ( 00919 2007/05/10 23:30:25 112 13 2007/05/10 23:30:25 1969/12/31 17:00:00 0500 ( 00920 2007/05/10 23:30:26 000 00... (3 Replies)
Discussion started by: bucci
3 Replies

10. UNIX for Advanced & Expert Users

TCP/IP Connection getting slower...

Hi, We have developed a server program using TCP/IP Communication to communicate with another client program. After running for some days we find the TCP/IP connection from the server program is getting slower. What i mean to say is since the send() function in the server program (it is... (2 Replies)
Discussion started by: rajesh_puru
2 Replies
Login or Register to Ask a Question