List the computers in the same network in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jellychai
    New Member
    • Mar 2008
    • 6

    List the computers in the same network in C#

    I'm doing the final year project that related to the SNMP. I need to find the solution for the IP auto detection in C#. When I run the main project, the program can automatically detect the IP for the agent and retrieve it's MIB, so that the user do not need to enter the IP address of the agent. Beside that, I also look for the solution that can detect the nodes that had switch on or switch off in C# coding. Wish can get the solution for these two problems. Thank you.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What?
    Getting the IP address of the current computer is pretty simple. There is like a System.Net.Netw orkInformation. NetworkInterfac e class that handles that for you.
    Note: It does not necessarily give you the "outside" IP depending on your network configuration.

    So what are you ACTUALLY after?

    Comment

    • jellychai
      New Member
      • Mar 2008
      • 6

      #3
      Originally posted by Plater
      What?
      Getting the IP address of the current computer is pretty simple. There is like a System.Net.Netw orkInformation. NetworkInterfac e class that handles that for you.
      Note: It does not necessarily give you the "outside" IP depending on your network configuration.

      So what are you ACTUALLY after?
      I know to get the local IP (127.0.0.1), but what I means here is that the IP for the nodes those connect to my manager, I need to retrieve their MIB without enter their IP. I do not know the coding for it in the C#.

      This is the part of my coding that use to open the connection between manager and the agent:
      [code=cpp]
      private void ButtonOpen_Clic k(object sender, System.EventArg s e)
      {
      Cursor.Current = Cursors.WaitCur sor;
      objSnmpManager. ProtocolVersion = ComboVersion.Se lectedIndex + 1;
      objSnmpManager. LogFile = TextLogFile.Tex t;

      objSnmpManager. Open(TextAgent. Text, TextCommunity.T ext, Int16.Parse(Tex tPort.Text));

      if (GetResult() == 0)
      {
      bOpened = true;
      EnableControls( );
      }

      Cursor.Current = Cursors.Default ;
      }[/code]

      Thanks for your help.
      Last edited by Frinavale; Mar 11 '08, 01:51 PM. Reason: Added [code] tags

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        What? What do you mean by "nodes" and "MIB" ? Is that something propriatary to your company?

        Comment

        • jellychai
          New Member
          • Mar 2008
          • 6

          #5
          Originally posted by Plater
          What? What do you mean by "nodes" and "MIB" ? Is that something propriatary to your company?
          The nodes that i means is the laptops those connect to my SNMP manager. MIB is the management information base. I still the student, this just my final year project, i just want to find solution to automatically detect IP, i do not want to enter the IP address manually.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by jellychai
            The nodes that i means is the laptops those connect to my SNMP manager. MIB is the management information base. I still the student, this just my final year project, i just want to find solution to automatically detect IP, i do not want to enter the IP address manually.
            What type of application are you creating?
            Web Service, Web Application, Desktop Application...e tc?

            -Frinny

            Comment

            • jellychai
              New Member
              • Mar 2008
              • 6

              #7
              Originally posted by Frinavale
              What type of application are you creating?
              Web Service, Web Application, Desktop Application...e tc?

              -Frinny
              Type of appliation that i do is windows application.

              Comment

              • jellychai
                New Member
                • Mar 2008
                • 6

                #8
                List the computers in the same network in C#

                I need to find the solution to list out all the computers in same local network. Such as i have 4 computers in my local network, I need to list out all the IP address for these 4 computers by using C# coding. Have everyone can help me?

                Thank you.

                Best Regard,
                Jelly Chai

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  Unless you have a domain controller (or just a good active directory?)
                  I think you need to rely on netbios (command prompt: NET VIEW) or equivilants.
                  Then you can do a dns request for those names agaisnt your system.

                  WMI might be a good choice for getting all this information.

                  Comment

                  • jellychai
                    New Member
                    • Mar 2008
                    • 6

                    #10
                    Originally posted by Plater
                    Unless you have a domain controller (or just a good active directory?)
                    I think you need to rely on netbios (command prompt: NET VIEW) or equivilants.
                    Then you can do a dns request for those names agaisnt your system.

                    WMI might be a good choice for getting all this information.
                    I do not understand what you means? I just need to list out all the computers that connected to my master computer which are in the same network. I need to know those computers by using C# coding, because it will used for my SNMP program. Can you teach me how to write the coding for it?

                    Thank you.

                    Comment

                    • Plater
                      Recognized Expert Expert
                      • Apr 2007
                      • 7872

                      #11
                      So there is a domain controller? LDAP should work then

                      Comment

                      • Plater
                        Recognized Expert Expert
                        • Apr 2007
                        • 7872

                        #12
                        Have you looked into LDAP ?



                        I have merged these two threads, please do not double post. If the future if you wish to clarify your initial question, please post the clarification in the same thread.
                        MODERATOR

                        Comment

                        Working...