Re: Sockets: connection refused




Oliveira wrote:

I have a Linux server (FC3) with 3 application that collects several
data from 3 equipments using sockets.
These 3 application are restarted (killed and start) each 15 minutes.
Several hours later, when restarting the application, I get a
'Connection refused' error (in the 3 application).
After this error if we reboot the server everthing goes OK. After
several hours the same error happens.
Does any one has an ideia how to find what is causing this kind of
problema?

When you get a 'connection refused', it usually means that nothing is
listening on the port you're trying to connect to. There are many
reasons this can happen.

First, check to make sure that the program that listens on that port is
actually running. Then check to see if it has a socket bound to that
port (with 'netstat' or a similar tool). Then check to make sure it
hasn't hung or crashed.

Also, make sure the application will not start up if it fails to bind
to its primary port (the one that you're connecting to). At an absolute
minimum, log the inability to bind to the port on startup and see if
that log entry coincides with your problem.

In other words, troubleshoot the error condition and narrow it down. If
I had to take a total guess, I'd guess that it's a combination of not
setting SO_REUSEPORT and not being diligent in attempting to 'bind' on
startup.

DS

.



Relevant Pages

  • Re: Sockets: connection refused
    ... data from 3 equipments using sockets. ... Several hours later, when restarting the application, I get a ... check to make sure that the program that listens on that port is ... it might be a resource leak in the server. ...
    (comp.unix.programmer)
  • Re: Binding multiple udp sockets to same local port???
    ... Is it possible to bind multiple udp sockets to same local port but each ... By bind means calling bind() function and by connect means calling ...
    (microsoft.public.win32.programmer.networks)
  • Re: Sockets: connection refused
    ... data from 3 equipments using sockets. ... Several hours later, when restarting the application, I get a ... check to make sure that the program that listens on that port is ... it might be a resource leak in the server. ...
    (comp.unix.programmer)
  • Re: persistent connection
    ... is this possible to create multiple sockets on the same port i mean ... multiple sockets on the same local port, ... That happens if you try to BIND two sockets to the same port. ...
    (comp.unix.programmer)
  • Binding to a client port and REUSEADDR
    ... I have an application that creates two sockets and established a TCP ... I have been asked if I can establish my connections from the same port. ... When creating my two sockets I have used the following code to bind ... // Error logging code. ...
    (comp.unix.programmer)

Loading