Thread: detect being blocked by a firewall

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    2

    Question detect being blocked by a firewall

    Hi all!
    as a maker of (a legitimate) application that need a connection to the server, how can I precisely detect that connection was blocked by a firewall (the problem is that user may accidetially block the application when firewall's pop-up window appeared, or forget to configure firewall, etc. - I want to tell him that application is blocked and suggest to make appropriate actions)

    Thanks!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    I'm thinking its going to be pretty tricky to tell the difference between being blocked by a firewall, and having the connection refused by a reachable server which is say too busy, or a server which is simply off-line at that moment.

    Not to mention telling the difference between say an application level firewall running on the local machine, and a perimeter firewall separating the local LAN from the internet.

    Mostly I would prefer a simple popup dialog suggesting courses of action.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    Basicly, you can't. Their are 2 common ways a firewall will "block" an incomming connection, either completely drop the packets, and no respond at all (act like a black hole as they say), or send a reset icmp packet. The reset packet will normally cause your socket to close with an error I think. Check your API docs (man pages or MSDN, etc, depends on OS) for more.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  4. #4
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Quote Originally Posted by Xipher
    Basicly, you can't. Their are 2 common ways a firewall will "block" an incomming connection, either completely drop the packets, and no respond at all (act like a black hole as they say), or send a reset icmp packet. The reset packet will normally cause your socket to close with an error I think. Check your API docs (man pages or MSDN, etc, depends on OS) for more.

    i think he's talking about the firewall and the application on the same system, a local firewall (like zonealarm, for example). in that case the icmp reset it pretty much useless, you will only recieve the icmp if your packets are trying to pass through the firewall, and not from within it to the outside world.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to Write a Program in C to detect the Ethernet Cable?
    By christyyim in forum C Programming
    Replies: 1
    Last Post: 03-11-2009, 04:12 AM
  2. Win Xp firewall detection
    By wind_addict in forum Windows Programming
    Replies: 1
    Last Post: 04-30-2008, 12:13 PM
  3. Firewall Conflict
    By Davros in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 05-22-2004, 03:17 PM
  4. Replies: 5
    Last Post: 11-20-2003, 01:27 AM
  5. Norton Firewall
    By MethodMan in forum Tech Board
    Replies: 4
    Last Post: 02-14-2003, 06:46 PM