Network Diagram in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saurabh9gupta
    New Member
    • Aug 2009
    • 52

    Network Diagram in c#

    I want ot generate a Network Diagram based on the information Stored in my Database
    IP ADRESS STATUS
    128.98.76.6 Active
    128.96.35.21 Active
    128.5.68.9 Not Active

    I want to generate a network diagram in which the Active nodes are shown by a green link and non active in Red link.
    How should i do this in C#
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    What have you coded/tried so far? Without a better idea of what you have done so far, any suggestions someone might have here may in no way correspond or even be compatible

    Comment

    • cloud255
      Recognized Expert Contributor
      • Jun 2008
      • 427

      #3
      Hi

      Well I suggest you start by creating an object design which will store the data you retrieve from the database in memory.

      You will be adding controls to a form at runtime. You will have to decide on a general algorithm which will dictate how controls are arranged on the form.

      Next looking into the drawing classes of .NET, these will enable you to draw pretty much anything on a form. MSDN

      If your network is very large think about how you may design your objects in such a way that different regions of the network may be viewed individually.

      If you want real time updates of your UI based on the state of the network you will also need to look at network communications, the NetworkInformat ion namespace will help with this MSDN

      Also for real time updates look into threading MSDN

      Read the MSDN entries if you are unfamiliar with any of the required components and create a design with clear goals of what you want to achieve.

      Try to create the app even if you fail, its the best way to learn, then post any problems/questions you may encounter and we'll have a look at how to help you out.

      Comment

      • saurabh9gupta
        New Member
        • Aug 2009
        • 52

        #4
        Hello...
        I am taking the readymade processes in Windows...syste m32 folder like ping.exe,...etc .
        I am executing the process using Sytem.Diagnosti cs library...
        Now what i have to do is store the some data that is displayed in the message box like


        the output of ping is

        C:\>ping 172.16.73.4

        Pinging 172.16.73.4 with 32 bytes of data:

        Reply from 172.16.73.4: bytes=32 time=16ms TTL=127
        Reply from 172.16.73.4: bytes=32 time=21ms TTL=127
        Reply from 172.16.73.4: bytes=32 time=19ms TTL=127
        Reply from 172.16.73.4: bytes=32 time=26ms TTL=127

        Ping statistics for 172.16.73.4:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
        Approximate round trip times in milli-seconds:
        Minimum = 16ms, Maximum = 26ms, Average = 20ms


        take a look at this the Lost is 0%...
        Now what has to be done is that I have to save the Lost % along with the IP ADDRESS and display the output in the form of Network Diagram i.e display a server and the pinged nodes....

        Comment

        • cloud255
          Recognized Expert Contributor
          • Jun 2008
          • 427

          #5
          Ok, so have you written any code for this yet? Are you stuck with some particular piece of code/design? You haven't asked any questions in your above post only told us what you plan to do...

          Comment

          • Catalyst159
            New Member
            • Sep 2007
            • 111

            #6
            This would be a great Idea . I was trying to do something similiar to this using Visio. Have you made any progress ? This would be a good project. Generating a network topology based on the information, and the display would be a realtime representation of the network.

            Comment

            • saurabh9gupta
              New Member
              • Aug 2009
              • 52

              #7
              Yes...so far i am able to execute the ping,ipconfig,n etstat,nslookup ,tracert and redirect the output from DOS Screen(without displaying it) and display the output in a message box..

              but i am stuck like
              1) i want to generate the network diagram (real time).. this is the problem on how to generate the diagram...
              I need your help..

              Comment

              • Catalyst159
                New Member
                • Sep 2007
                • 111

                #8
                Would you want to work on this as a project? What do you have so far ?

                Comment

                • saurabh9gupta
                  New Member
                  • Aug 2009
                  • 52

                  #9
                  I am currently working on this project...
                  .so far i am able to execute the ping,ipconfig,n etstat,nslookup ,tracert and redirect the output from DOS Screen(without displaying it) and display the output in a message box..

                  but i am stuck like
                  1) i want to generate the network diagram (real time).. this is the problem on how to generate the diagram...
                  I need your help..

                  Comment

                  • Catalyst159
                    New Member
                    • Sep 2007
                    • 111

                    #10
                    Please post the code you have so far>?

                    Comment

                    • saurabh9gupta
                      New Member
                      • Aug 2009
                      • 52

                      #11
                      string ping;
                      ping = " /c ping -n 1 " + textBox1.Text;
                      System.Diagnost ics.ProcessStar tInfo sinf = new System.Diagnost ics.ProcessStar tInfo("cmd", ping);

                      sinf.RedirectSt andardOutput = true;
                      sinf.UseShellEx ecute = false;

                      sinf.CreateNoWi ndow = true;

                      System.Diagnost ics.Process p = new System.Diagnost ics.Process();
                      p.StartInfo = sinf;
                      p.Start();

                      string res = p.StandardOutpu t.ReadToEnd();

                      Process procCommand = Process.Start(s inf);



                      StreamReader srIncoming = procCommand.Sta ndardOutput;



                      MessageBox.Show (srIncoming.Rea dToEnd());



                      }



                      The output of the code will be like this

                      Pinging 172.16.73.12 with 32 bytes of data:

                      Reply from 172.16.73.12: bytes=32 time<1ms TTL=63

                      Ping statistics for 172.16.73.12:
                      Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
                      Approximate round trip times in milli-seconds:
                      Minimum = 0ms, Maximum = 0ms, Average = 0ms

                      Comment

                      • Catalyst159
                        New Member
                        • Sep 2007
                        • 111

                        #12
                        Did you do this in Visual C++ 2008 Express?

                        Comment

                        • saurabh9gupta
                          New Member
                          • Aug 2009
                          • 52

                          #13
                          No
                          I did this in C#
                          My version was Microsoft Visual Studio 2005 (3.0 Environment)

                          Comment

                          • Catalyst159
                            New Member
                            • Sep 2007
                            • 111

                            #14
                            O ok. what namespaces do you use?

                            Comment

                            • saurabh9gupta
                              New Member
                              • Aug 2009
                              • 52

                              #15
                              System.Diagnost ics;
                              System.IO;

                              Please Help me !!!
                              I have to complete this project in a very short span of time

                              Comment

                              Working...