Thread: Detect if a computer is behind a lan or Directly connected to the internet

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    319

    Detect if a computer is behind a lan or Directly connected to the internet

    Does anyone know to detect if a computer is directly connected to the internet or that its using a router etc, gotta be with code to

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I'm not going to say absolutely no, because likely there is some protocol by which you could at least indirectly infer that (since your ISP can communicate with your router from outside, and I guess where there's a router, there's a LAN). Investigating this might be your best bet; while you will certainly run afoul of some authority by breaking into a remote router, there may be a legitimate means of querying to see if a router is there and if it can respond to such and such a protocol.

    Outside of that, tcp/ip packet headers contain both the IP address (that of the router) and the computer specific MAC address (which allows the router to route correctly). Of course, this alone is indistinguishable from a lone computer...
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    You're ALWAYS connected to a router. What exactly do you mean by "directly connected?"
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 21
    Last Post: 06-24-2009, 09:49 AM
  2. Detect internet reachable
    By kotao_78 in forum Linux Programming
    Replies: 1
    Last Post: 07-18-2007, 12:51 AM
  3. Replies: 34
    Last Post: 02-26-2006, 01:16 PM
  4. computer problem... me can't fix... internet
    By compjinx in forum Tech Board
    Replies: 2
    Last Post: 03-07-2003, 02:01 PM
  5. connected?
    By Shakespeare in forum C++ Programming
    Replies: 3
    Last Post: 01-23-2003, 08:42 AM