Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Webvisu - webserver - client counter

miczieli
2016-05-23
2016-06-29
  • miczieli - 2016-05-23

    Hi, I'm using Codesys v. 3.5 SP7 with Berghof IEC 2250, and I've got one question.
    I've read somewhere that webserver can support up to 100 clients. I want to test it. I've prepared a visualisation already.
    My question: is there any counter or method to count number of clients currently connected to webvisu via browser?

     
  • eschwellinger

    eschwellinger - 2016-05-30

    Hi,

    try it that way:

    You Need to call this in visutask context 'VISU_TASK'

    PROGRAM CountClients
    VAR
           pClient: POINTER TO VisuElems.VisuElemBase.VisuStructClientData;
           countWebvisu: INT;
           countAll: INT;
    END_VAR
    

    __Implementation______

    ```

    countWebvisu := 0;
    countAll := 0;
    g_ClientManager.BeginIteration();

    WHILE (pClient := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO
           IF pClient^.GlobalData.ClientType = VisuElems.VisuElemBase.Visu_ClientType.WebVisualization THEN
                 countWebvisu := countWebvisu + 1;
           END_IF

           countAll := countAll + 1;
    END_WHILE

    ```BR
    Edwin

     
  • miczieli - 2016-06-29

    Thank u a lot for your answear but I'm a newbie so I need some more explanation

    As I understood this part:

    Zitat:
    PROGRAM CountClients
    VAR
    pClient: POINTER TO VisuElems.VisuElemBase.VisuStructClientData;
    countWebvisu: INT;
    countAll: INT;
    END_VAR

    Stood for a structure (DUT) named CountClients.

    The second part stands for POU named g_ClientManager.

    But if i want to add CountClients to VISU_TASK as a call the program goes into the exception.
    And if i would like to add a g_ClientManager as a call in VISU_TASK i can't because its type is TYPE.

    What have i done wrong?

    I tried with VISU_NO_EXCEPTION_HANDLING but it failed, with 42 errors like Problem during creating a client: we are out of memory.

     

Log in to post a comment.