Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an application which is separated to several parts (processes) communicating over TCP/IP, using a pre-defined port on localhost.

Is this always safe? Can some kind of a firewall (corporate, locally installed, Windows firewall, etc) block this traffic? Or can some user settings in the OS that can block this traffic?

The OSes I'm interested in are Windows (XP through 7) and Linux (Ubuntu, RHEL, SUSE)

share|improve this question
    
I'm not sure if you're trying to prevent the traffic or make sure the traffic goes through? Traffic going through a specific port can always be blocked, if someone volunteers to do so. –  CreeDorofl Mar 27 '11 at 15:15
    
@CreeDorofl: make sure it goes through –  Eli Bendersky Mar 27 '11 at 15:35

2 Answers 2

up vote 5 down vote accepted
  • Traffic to 127.0.0.0/8 and to ::1/128 is processed internally by the TCP/IP stack. It doesn't reach the physical network card and never leaves the computer, so it cannot be blocked by corporate firewalls.

  • Since loopback sockets are very common for IPC, good firewalls should never block it. (Windows Firewall doesn't.) However, there are some overly paranoid ones... In such cases, though, I would blame the firewall, not your software.

  • On Unix, it is possible to (accidentially) bring down the loopback interface (usually lo). Again, this is highly unusual.

  • Instead of a hardcoded port, socketpair() should be used when applicable, to avoid port collisions.

  • Even better would be to use Unix sockets on Linux and named pipes on Windows.

share|improve this answer

All these OSes support running firewall software. These could block localhost connections, although that's not very usual (in my experience).

There are lots of applications/services that do this. Just try running netstat -an on your box: chances are you will see quite a few applications with open listening sockets on 127.0.0.1.

I don't know of user settings that could prevent this from working on Linux. No idea for Windows. But again, this is a common technique.

share|improve this answer

Your Answer

 
discard

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.