Showing results 1 to 3 of 3

Thread: How to: get the state of a network adapter

  1. #1
    martins Gast

    Default How to: get the state of a network adapter

    hi,

    as this question appears from time to time, I created a small sample how to get the network information from the available network interfaces into zenon.

    I used the NetworkChange class from the .NET Framework (in namespace System.Net.NetworkInformation) and took the NetworkAddressChanged event to get notified about changes in the IP address. Alternativly, the NetworkAvailabilityChanged event could also be used - but there, I get no events if the IP changed (as the name already suggests )

    The sample does the following:

    Everytime the IP address of an adapter changes (can be because of a different allocation of an IP address or because we lost the connection or because the adapter was disabled), we get the information from all interfaces in the network. In this demo, I then write this information onto a zenon variable of type string and display that string in the runtime. In reality, you could e.g. execute a zenon function (by calling this.RtFunctions().Item("myFunction").Start()) or writing some values onto a zenon variable on which you can react with a limit violation or a reaction matrix.

    Note that I tried my best to eliminate any possible errors, but: I cannot guarantee that the source code is without any mistakes.

    It is a zenon 7.0 project optimized for 1280x1024. Feel free to try it out, improve it, add a comment or something else

    best regards,
    Martin
    Attached Files Attached Files

  2. #2
    select as best answer

    Default Re: How to: get the state of a network adapter

    Hello, Martin!

    I have some offtopic question for your project.
    I changed main screen type to CEL and insert CEL table into it. By default such table has some columns set (without Value column). Typically columns are configured in screen switch function call for CEL type screen, but in case of CEL screen as startup screen there is no such ability.

    Question is what it get this set from and how to change this set in case of using CEL screen as startup screen?

  3. #3
    Join Date
    20.08.2009
    Posts
    293
    select as best answer

    Default AW: How to: get the state of a network adapter

    Hi,

    why don't remove the "Start screen" in the project settings, and put a screen switch function to the CEL with the designated paramaters into the AUTOSTART script?

    Regards,
    Bernhard

Similar Threads

  1. How to evaluate the locked state?
    By markclemens in forum zenon Energy Edition
    Replies: 1
    Last Post: 28th January 2016, 11:16
  2. Replies: 2
    Last Post: 27th March 2012, 21:03
  3. Network Project
    By fafdaniel in forum zenon Network
    Replies: 1
    Last Post: 5th October 2011, 23:33
  4. Rema state
    By westbaaam in forum VBA
    Replies: 1
    Last Post: 30th November 2009, 06:32
  5. installation of 6.22 SP0 hangs, leaving the system in an inoperable state
    By markclemens in forum Editor and Runtime Setup
    Replies: 0
    Last Post: 10th March 2008, 17:44

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •