Network Computers

Discussion in 'C Programming' started by Santy, Oct 11, 2006.

  1. Santy

    Santy Guest

    Hello Friends,

    I am making an application in which i need to list all the computers in
    my network.

    can anyone suggest any code to accomplish this task.

    Thanks
    Santosh
    Santy, Oct 11, 2006
    #1
    1. Advertising

  2. Santy

    santosh Guest

    Santy wrote:
    > Hello Friends,
    >
    > I am making an application in which i need to list all the computers in
    > my network.
    >
    > can anyone suggest any code to accomplish this task.
    >
    > Thanks
    > Santosh


    This will depend on the API provided by the underlying OS. This group
    deals mainly with ISO C, which has no notion of networks. Ask in a
    group which deals with programming under your OS. Generally, there're
    fairly portable POSIX APIs to do this, unless you happen to code for
    Billy Gates.
    santosh, Oct 11, 2006
    #2
    1. Advertising

  3. Santy wrote:
    >
    > Hello Friends,
    >
    > I am making an application in which i need to list all the computers in
    > my network.
    >
    > can anyone suggest any code to accomplish this task.


    This can't be done in standard C. Your networking software may have
    some platform-specific calls that you can use. However, to find out
    about that, you'll need to check somewhere else -- either the manual
    that came with the network or C compiler, or a newsgroup that talks
    about your platform.

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
    Kenneth Brody, Oct 11, 2006
    #3
  4. In article <>,
    santosh <> wrote:
    >Santy wrote:


    >> I am making an application in which i need to list all the computers in
    >> my network.


    >This will depend on the API provided by the underlying OS. This group
    >deals mainly with ISO C, which has no notion of networks. Ask in a
    >group which deals with programming under your OS.


    Correct so far.

    >Generally, there're
    >fairly portable POSIX APIs to do this, unless you happen to code for
    >Billy Gates.


    Unfortunately that part is not correct. There are no POSIX APIs
    to enumerate all the computers in any network -- not even if one
    confines oneself to a particular subnet. No matter what API you
    use on computer X, computer Y might be programmed to ignore all
    packets from computer X.

    --
    If you lie to the compiler, it will get its revenge. -- Henry Spencer
    Walter Roberson, Oct 11, 2006
    #4
  5. On Wed, 11 Oct 2006 16:47:45 +0000 (UTC), in comp.lang.c ,
    -cnrc.gc.ca (Walter Roberson) wrote:

    >In article <>,
    >santosh <> wrote:
    >>Santy wrote:

    >
    >>> I am making an application in which i need to list all the computers in
    >>> my network.


    >>Generally, there're
    >>fairly portable POSIX APIs to do this, unless you happen to code for
    >>Billy Gates.

    >
    >Unfortunately that part is not correct. There are no POSIX APIs
    >to enumerate all the computers in any network -- not even if one
    >confines oneself to a particular subnet. No matter what API you
    >use on computer X, computer Y might be programmed to ignore all
    >packets from computer X.


    The Billy Gates part is also incorrect. Unless you're running an
    antique version of Windows from the early nineties (in which case, you
    ought to mention Stevie J too) it'll respond to much the same
    protocols as any other networked device.

    --
    Mark McIntyre

    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Oct 11, 2006
    #5
  6. >>Unfortunately that part is not correct. There are no POSIX APIs
    >>to enumerate all the computers in any network -- not even if one
    >>confines oneself to a particular subnet. No matter what API you
    >>use on computer X, computer Y might be programmed to ignore all
    >>packets from computer X.

    >
    >The Billy Gates part is also incorrect. Unless you're running an
    >antique version of Windows from the early nineties (in which case, you
    >ought to mention Stevie J too) it'll respond to much the same
    >protocols as any other networked device.


    Are you claiming that no recent version of Windows has a working
    firewall that can block all packets from a particular IP or netblock?
    ("recent" includes at least Windows XP) Even if that's true, I can
    still put a Cisco router in between that computer and the outside
    world to implement that block.
    Gordon Burditt, Oct 12, 2006
    #6
  7. Santy

    Santy Guest

    Santy wrote:
    > Hello Friends,
    >
    > I am making an application in which i need to list all the computers in
    > my network.
    >
    > can anyone suggest any code to accomplish this task.
    >
    > Thanks
    > Santosh




    for coding The application i am using the Gcc C compiler on Linux
    Platform.
    Santy, Oct 12, 2006
    #7
  8. Santy wrote:
    > Hello Friends,
    >
    > I am making an application in which i need to list all the computers in
    > my network.
    >
    > can anyone suggest any code to accomplish this task.
    >
    > Thanks
    > Santosh



    sure: system( "nmap -Sp >/tmp/MyOut.Txt" )

    That's a joke of sorts.

    There is nothing in C itself to have anything to do with networks.

    But with the system() function you can run an external program.
    Luckily there's a free program called "nmap" that can do a pretty
    awesome job of peeking at a network. Use google to find where to
    download nmap source or binary and go to it!
    Ancient_Hacker, Oct 12, 2006
    #8
  9. Santy

    CBFalconer Guest

    Santy wrote:
    > Santy wrote:
    >>
    >> I am making an application in which i need to list all the
    >> computers in my network.
    >>
    >> can anyone suggest any code to accomplish this task.

    >
    > for coding The application i am using the Gcc C compiler on Linux
    > Platform.


    This is off-topic for c.l.c. The C language knows zip about
    networks. Find a newsgroup with the word 'linux' in its name.

    --
    Some informative links:
    <news:news.announce.newusers
    <http://www.geocities.com/nnqweb/>
    <http://www.catb.org/~esr/faqs/smart-questions.html>
    <http://www.caliburn.nl/topposting.html>
    <http://www.netmeister.org/news/learn2quote.html>
    <http://cfaj.freeshell.org/google/>
    CBFalconer, Oct 12, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WWallace
    Replies:
    0
    Views:
    686
    WWallace
    Oct 23, 2003
  2. Replies:
    2
    Views:
    304
  3. Sandeep Arya

    Detecting computers on network

    Sandeep Arya, Jul 22, 2005, in forum: Python
    Replies:
    5
    Views:
    331
    Sybren Stuvel
    Jul 22, 2005
  4. Sandeep Arya

    Detecting computers on network

    Sandeep Arya, Jul 22, 2005, in forum: Python
    Replies:
    3
    Views:
    2,178
    Marek Kubica
    Jul 24, 2005
  5. dylpkls91
    Replies:
    16
    Views:
    598
    dylpkls91
    Jul 19, 2006
Loading...

Share This Page