0

Machine is RHEL 5.3 (kernel 2.6.18).

Some times I notice in netstat that my application has connection, when Local Address and Foreign Address are same.

How it's possible?

Update 1

I catch it on netstat:

tcp        0      0 127.0.0.1:50003             127.0.0.1:50003             ESTABLISHED

Update 2

Here same problem reported by someone else too.

dimba
  • 293
  • 1
  • 2
  • 11
  • What is the context of this question? Which application are you talking about? –  Feb 09 '11 at 06:10
  • This is application I work on. But the question is general - I don't see how "physically" such behavior is possible. – dimba Feb 09 '11 at 06:14
  • Found an answer on stackoverflow: http://stackoverflow.com/questions/4949858/how-can-you-have-a-tcp-connection-back-to-the-same-port – JimB Feb 10 '11 at 14:49

1 Answers1

2

That just means that an application is connecting to another application on your machine. An application talking to a database for example.

mrdenny
  • 27,174
  • 4
  • 41
  • 69
  • Do you mean application in process of connection or it already connected? – dimba Feb 09 '11 at 06:13
  • 1
    That depends on the state of the connection. What does the state show? – mrdenny Feb 09 '11 at 06:15
  • Actually this is very very rare problem and I don't remember actual state. I basically don't understand how in TCP connection it is possible. I hope, when I'll understand it, I can find my problem – dimba Feb 09 '11 at 06:36
  • @Dima, If two applications which are installed on your computer, such as a web server and a database server, need to talk to each other they use the same technique to do so if the applications are installed on the same machine, or if they are on different machines. The listening service, the database is this case, listens on a TCP socket for connections. It listens on the normal IP, as well as localhost (127.0.0.1) for connections. The web server connects to that TCP port so that it can talk to the database. – mrdenny Feb 09 '11 at 06:42
  • You're describing standard client/server connection. The problem I experience is that netstat tells that connection has exactly same local and remote address. – dimba Feb 09 '11 at 06:53
  • Correct, when applications or services need to talk to either other on the local machine, they still do the exact same client/server connection process. The connections just never leave the server's network card. – mrdenny Feb 09 '11 at 22:22
  • @mrdenny, you're missing the point - the connection is also on the *same socket* – JimB Feb 10 '11 at 14:48
  • OK, that I can't explain. – mrdenny Feb 11 '11 at 21:45