0

In a C# program running on windows, I try to make an outgoing tcp connection on the local-area network. Obviously a connection can be refused because of several reason, but is there a way to know if a particular connection refusal is because of Firewall on the host window's computer where this program is running ?

PS: looking for programming solutions

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Ahmed
  • 14,503
  • 22
  • 92
  • 150
  • 1
    Unless there's something new in the TCP specifications, there's no way to know. Refusal of a connection doesn't include a reason for refusal. I also don't know any way to "probe" a connection to see if it would be refused. – John Saunders Nov 23 '12 at 02:13
  • thanks, then is there an alternate like engaging the firewall and checking list of allowed/blocks programs ? – Ahmed Nov 23 '12 at 02:15
  • 2
    Which firewall? The one on the local machine? The one on the router or other piece of network equipment on-premises? The one at the other end of the connection? No, I don't believe there is. Why would anyone tell you why they're blocking you? So a hacker can try to get in a different way? – John Saunders Nov 23 '12 at 02:17

1 Answers1

-4

You can enable logging on the windows firewall by following these instructions

  1. Open Windows Firewall, and click the Advanced tab.
  2. In Security Logging, click Settings.
  3. In the Log Settings dialog box, click Save As.
  4. Select items you want to log.
  5. Perform some activity and see the log update.

This is for windows xp - http://support.microsoft.com/kb/875357.

Kami
  • 19,134
  • 4
  • 51
  • 63
  • Thanks, but I am looking for a programming solution.. – Ahmed Nov 23 '12 at 02:03
  • Thanks for the -ve, but in the question asked; There is no request for a programmatic solution. Duplicate of - http://stackoverflow.com/questions/6943205/detect-if-windows-firewall-is-blocking-my-program – Kami Nov 23 '12 at 02:07
  • 6
    This is a website for programming-related questions, so it's safe to assume that the OP wants a programming-related solution. – David Brown Nov 23 '12 at 02:09