Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. sharing info with other programs

sharing info with other programs

Scheduled Pinned Locked Moved Visual Basic
csharpvisual-studiosysadmindiscussionworkspace
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cj4331
    wrote on last edited by
    #1

    I have a TCP/IP server (VB .net 2.0 Windows App) that accepts connections from clients receives a string from them and passes back an answer. The TCP/IP Server creates a thread for each connection and that thread handles that connection then terminates. Each of these connection threads increments a counter class when it starts and decrements it when it finishes. The main thread in the TCP/IP server program queries the value of the counter class periodically to see how many threads are being handled at that time. This is working perfectly and has been for well over a year. Now, I need to share the value of this counter with other programs. In specific we are going to start using Microsoft's System Center Manager to monitor and alert of potential problems etc. After a discussion with my Boss it is clear that he would like a way to reach into my program and pull this value vs. having my program write it to an environment variable or even a file that could be read. I think this should be doable but I'm not sure exactly what I should be looking to do. Keep in mind the TCP/IP server is a Windows App. Any advise would be appreciated.

    D 1 Reply Last reply
    0
    • C cj4331

      I have a TCP/IP server (VB .net 2.0 Windows App) that accepts connections from clients receives a string from them and passes back an answer. The TCP/IP Server creates a thread for each connection and that thread handles that connection then terminates. Each of these connection threads increments a counter class when it starts and decrements it when it finishes. The main thread in the TCP/IP server program queries the value of the counter class periodically to see how many threads are being handled at that time. This is working perfectly and has been for well over a year. Now, I need to share the value of this counter with other programs. In specific we are going to start using Microsoft's System Center Manager to monitor and alert of potential problems etc. After a discussion with my Boss it is clear that he would like a way to reach into my program and pull this value vs. having my program write it to an environment variable or even a file that could be read. I think this should be doable but I'm not sure exactly what I should be looking to do. Keep in mind the TCP/IP server is a Windows App. Any advise would be appreciated.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There's a bunch of different ways of doing this, depending on your environment. Probably the best way to do it is to change the server code to expose the number you were talking about as a PerformanceCounter. Other programs can then use the performance counter information to get the current count. An Introduction To Performance Counters[^]. The code is in C#, but is easily translatable to VB.NET.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      C 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There's a bunch of different ways of doing this, depending on your environment. Probably the best way to do it is to change the server code to expose the number you were talking about as a PerformanceCounter. Other programs can then use the performance counter information to get the current count. An Introduction To Performance Counters[^]. The code is in C#, but is easily translatable to VB.NET.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        C Offline
        C Offline
        cj4331
        wrote on last edited by
        #3

        Is the performance counter the same thing as WMI?

        D 1 Reply Last reply
        0
        • C cj4331

          Is the performance counter the same thing as WMI?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Nope. But WMI has it's option too, where you're able to create a custom class to do this. It's more work than creating a PerformanceCounter implementation though.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          C 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Nope. But WMI has it's option too, where you're able to create a custom class to do this. It's more work than creating a PerformanceCounter implementation though.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            C Offline
            C Offline
            cj4331
            wrote on last edited by
            #5

            Ok, I just spoke with my boss and he's still deciding on what monitoring package to use so I kind of need to wait until I see what it is capable of reading now. I appreciate all your help.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups