How can my application detect the physical network problem

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default How can my application detect the physical network problem

    I have one application running on solaris and other on windows NT.
    These two
    communicate thro' sockets.
    The application running on solaris is server and the one running on
    windows is client.
    These two systems are connected through ethernet switch box.

    The application on solaris should be able to detect and inform user if
    there is some physical connection problem like wire unplugged from
    ethernet switch.
    I have ping program which sends and receives the icmp packets.
    When I tested this program independently, it seemed to work fine, i.e.
    when i unplugged the wire, ping returned that "resource temporarily
    unavailable"

    When I integrated this one with my real application, its not working.
    Once the client application connects, i get the host address of client
    and after this ping program checks the client periodically. When i
    unplug the wire, I expect recvfrom function to return <= 0 but it
    always returns number of bytes greater than 0.

    Is there any other way my application can detect physical network
    problem.
    When I unplug the wire, i see that syslogd puts a message "no MII link
    detected" in log file. Is it possible for my application to catch this
    message.
    This would be neat way rather than sending icmp packets all the time.
    Any help or suggestion will be appreciated.

    Thanks
    anita Guest

  2. Similar Questions and Discussions

    1. Problem with asp.net application locate on network share
      Hi all, I have an asp.net application (framework 1.1 sp1) on windows server 2003. When the document root is locate in local that's all ok... but...
    2. How to allow my Web Application access a network resource?
      All, I have an ASP.NET application (with FormAuthentication but it shouldn't matter because I may allow unauthenticated user also). I want to...
    3. can't access ASP web application from another PC in same network
      Hello, all My asp web application work perfectly at web server machine(localhost), but when I try it from another pc, I can see default.html, but...
    4. ASPNET Account Security Problem - Running a Web Application over a network share
      All, If anyone has been following my trials over the last week see(Setting up a Web Application on IIS 5.1 and ASP.Net Security Problems). I'm...
    5. Dir MX: (Network) application installer
      Hi, I would like to provide the users of the application I am going to develop with a graphic install wizard (installation of drivers, acrobat...
  3. #2

    Default Re: How can my application detect the physical network problem


    "anita" <anita_sc_2000@yahoo.com> wrote in message
    news:b0677a2a.0307101804.5077b79f@posting.google.c om...
    > When I integrated this one with my real application, its not working.
    > Once the client application connects, i get the host address of client
    > and after this ping program checks the client periodically. When i
    > unplug the wire, I expect recvfrom function to return <= 0 but it
    > always returns number of bytes greater than 0.
    If recvfrom returns bytes, you must be receiving some data. What are you
    receiving and where are you receiving it from? (Look at what you got.)
    > Is there any other way my application can detect physical network
    > problem.
    > When I unplug the wire, i see that syslogd puts a message "no MII link
    > detected" in log file. Is it possible for my application to catch this
    > message.
    > This would be neat way rather than sending icmp packets all the time.
    > Any help or suggestion will be appreciated.
    Loss of MII link doesn't measure what you want to measure. You want to
    measure, I presume, whether host A still has a network link to host B,
    regardless of what's inbetween them.

    DS


    David Schwartz Guest

  4. #3

    Default Re: How can my application detect the physical network problem

    "David Schwartz" <davids@webmaster.com> wrote in message news:<bel9ff$qf1$1@nntp.webmaster.com>...
    > "anita" <anita_sc_2000@yahoo.com> wrote in message
    > news:b0677a2a.0307101804.5077b79f@posting.google.c om...
    >
    > > When I integrated this one with my real application, its not working.
    > > Once the client application connects, i get the host address of client
    > > and after this ping program checks the client periodically. When i
    > > unplug the wire, I expect recvfrom function to return <= 0 but it
    > > always returns number of bytes greater than 0.
    >
    > If recvfrom returns bytes, you must be receiving some data. What are you
    > receiving and where are you receiving it from? (Look at what you got.)
    >
    > > Is there any other way my application can detect physical network
    > > problem.
    > > When I unplug the wire, i see that syslogd puts a message "no MII link
    > > detected" in log file. Is it possible for my application to catch this
    > > message.
    > > This would be neat way rather than sending icmp packets all the time.
    > > Any help or suggestion will be appreciated.
    >
    > Loss of MII link doesn't measure what you want to measure. You want to
    > measure, I presume, whether host A still has a network link to host B,
    > regardless of what's inbetween them.
    >
    > DS
    Thanks for the reply.
    The recvfrom() is reading the left out data on recv buffer and than it
    hangs.
    I have set the timeout for recv and have made socket non blocking.

    Its the same scenario when using tcp socket for communication, When I
    unplug, read() function takes some time to read the remaining data in
    the recv buffer, after it has read all that, the application is hung
    untill I plug back when it again starts getting data.
    Again I have set the timeout for recv to be 1 sec and also have made
    socket non blocking. Why is it still getting hung.

    Yes I want to find out if host A still has network with host B, is
    there any interrupt or some mechanism by which my application can find
    out if something wrong with network
    anita Guest

  5. #4

    Default Re: How can my application detect the physical network problem

    "David Schwartz" <davids@webmaster.com> wrote in message news:<bel9ff$qf1$1@nntp.webmaster.com>...
    > "anita" <anita_sc_2000@yahoo.com> wrote in message
    > news:b0677a2a.0307101804.5077b79f@posting.google.c om...
    >
    > > When I integrated this one with my real application, its not working.
    > > Once the client application connects, i get the host address of client
    > > and after this ping program checks the client periodically. When i
    > > unplug the wire, I expect recvfrom function to return <= 0 but it
    > > always returns number of bytes greater than 0.
    >
    > If recvfrom returns bytes, you must be receiving some data. What are you
    > receiving and where are you receiving it from? (Look at what you got.)
    >
    > > Is there any other way my application can detect physical network
    > > problem.
    > > When I unplug the wire, i see that syslogd puts a message "no MII link
    > > detected" in log file. Is it possible for my application to catch this
    > > message.
    > > This would be neat way rather than sending icmp packets all the time.
    > > Any help or suggestion will be appreciated.
    >
    > Loss of MII link doesn't measure what you want to measure. You want to
    > measure, I presume, whether host A still has a network link to host B,
    > regardless of what's inbetween them.
    >
    > DS
    Looks like for some reason when i posted reply before its was not successful, so
    trying again

    Thanks for the reply.
    The recvfrom() is reading the left out data on recv buffer and than it
    hangs.
    I have set the timeout for recv and have made socket non blocking.

    Its the same scenario when using tcp socket for communication, When I
    unplug, read() function takes some time to read the remaining data in
    the recv buffer, after it has read all that, the application is hung
    untill I plug back when it again starts getting data.
    Again I have set the timeout for recv to be 1 sec and also have made
    socket non blocking. Why is it still getting hung.

    Yes I want to find out if host A still has network with host B, is
    there any interrupt or some mechanism by which my application can find
    out if something wrong with network
    anita Guest

  6. #5

    Default Re: How can my application detect the physical network problem


    "anita" <anita_sc_2000@yahoo.com> wrote in message
    news:b0677a2a.0307111002.2433b3b4@posting.google.c om...
    > The recvfrom() is reading the left out data on recv buffer and than it
    > hangs.
    > I have set the timeout for recv and have made socket non blocking.
    You have made the socket non-blocking and recvfrom still blocks? That
    pretty much has to be a bug in your code.
    > Its the same scenario when using tcp socket for communication, When I
    > unplug, read() function takes some time to read the remaining data in
    > the recv buffer, after it has read all that, the application is hung
    > untill I plug back when it again starts getting data.
    > Again I have set the timeout for recv to be 1 sec and also have made
    > socket non blocking. Why is it still getting hung.
    You are seeing a 'read' to a non-blocking socket not return immediately?
    That should be impossible.
    > Yes I want to find out if host A still has network with host B, is
    > there any interrupt or some mechanism by which my application can find
    > out if something wrong with network
    No, there isn't. The only way you can tell is by sending data that
    requires a reply and not getting a reply.

    DS


    David Schwartz Guest

  7. #6

    Default Re: How can my application detect the physical network problem

    In article <Pine.GSO.4.44.0307111440420.8703-100000@unix.cs.tamu.edu>,
    Siddharth Choudhuri <choudhri@cs.tamu.edu> wrote:
    >> The recvfrom() is reading the left out data on recv buffer and than it
    >> hangs.
    >> I have set the timeout for recv and have made socket non blocking.
    >> Its the same scenario when using tcp socket for communication, When I
    >> unplug, read() function takes some time to read the remaining data in
    >> the recv buffer, after it has read all that, the application is hung
    >> untill I plug back when it again starts getting data.
    >
    >try select() with a timeout on the socket-fd that was opened with host B.
    Note that this technique will only work if the client sends something every
    second. Otherwise, you can't tell the difference between a network failure
    and the client simply not having anything to send.

    If you need to detect network failure, the application protocol has to
    include a "heartbeat", where the systems send something over the connection
    periodically, even if they have no real data to send (like the TV
    commercial where the guy keeps saying "Can you hear me now?").

    --
    Barry Margolin, [email]barry.margolin@level3.com[/email]
    Level(3), Woburn, MA
    *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
    Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
    Barry Margolin Guest

  8. #7

    Default Re: How can my application detect the physical network problem

    [email]anita_sc_2000@yahoo.com[/email] (anita) writes in comp.unix.programmer:
    |I have one application running on solaris and other on windows NT.
    |These two
    |communicate thro' sockets.
    |The application running on solaris is server and the one running on
    |windows is client.
    |These two systems are connected through ethernet switch box.
    |
    |The application on solaris should be able to detect and inform user if
    |there is some physical connection problem like wire unplugged from
    |ethernet switch.

    The machine can detect when the cable from it to the next device (in
    your case the switch) is not getting any signal, but not any network
    problem beyond that - it won't know if the switch is connected to any
    other device, including routers, other computers, other switches, etc.

    --
    __________________________________________________ ______________________
    Alan Coopersmith [email]alanc@alum.calberkeley.org[/email]
    [url]http://www.CSUA.Berkeley.EDU/~alanc/[/url] aka: [email]Alan.Coopersmith@Sun.COM[/email]
    Working for, but definitely not speaking for, Sun Microsystems, Inc.
    Alan Coopersmith Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139