1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
Everywhere
  • Everywhere
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Members
  3. maSu

Posts by maSu

  • KAREL: Socket Messaging and Timeout

    • maSu
    • January 29, 2019 at 2:20 PM

    Isn't there a way to define a timeout for MSG_CONNECT?

    A timeout would be much better for my case :thinking_face:

  • KAREL: Socket Messaging and Timeout

    • maSu
    • January 28, 2019 at 5:44 PM

    Hello,

    I've got a small problem:

    I'm using socket messaging to send simple commands from/to the robot from/to an IPC. The good news: Socket messaging is working, everything is fine if a client is connected. And here is my problem:

    The program is waiting in the line "MSG_CONNECT('S3',STATUS)" until a client is trying to connect. Now I've got the that case, that the client on the IPC is crashing or not available due to older software revisions (without or with a buggy client on the IPC). The server program is a background task so that it's started with the control of the robot.

    The server program can not be overwritten while it is running. But it is running always and waiting for a client which will never connect. Our service technicians are not able to shut down such programs because they don't know how to shut down background programs at all. They are able to copy files from A to B, that's all. And i don't want to tell them that much about the programs: The more they try to do on their own, the more mistakes they will do.

    So I'm looking for a simple solution to shut down my server program. If the client is connected, the program has a main while() loop with exit conditions (just a flag).

    I think there are 2 solutions:


    1)
    MSG_CONNECT and timeout. If MSG_CONNECT is just trying to connect for 30 seconds, the technicians would be able to set a FLAG=TRUE and then they wait 30 seconds.

    Example:

    Code
    exitServer=FALSE
    serverOn=FALSE
    WHILE exitServer=FALSE DO
    
    
      -- need some timeout here! 
      -- max time for MSG_CONNECT=30 seconds or something like that.
      MSG_CONNECT('S3:', STATUS)
    
    
      IF STATUS = 0 THEN
        WRITE('Connection Established', CR)
        serverOn=TRUE
        WHILE serverOn=TRUE DO
          DELAY(200)
          --...do some stuff
        ENDWHILE
      ELSE
       WRITE('Connection error', CR)
      ENDIF
      exit=FLG[2]
      DELAY(500)
    ENDWHILE
    Display More

    If MSG_CONNECT would try to connect for 30 seconds, this loop can be canceled by setting FLG[2]=TRUE and waiting up to 30seconds.
    Is this possible?

    I tried the FILE_ATTRIBUE ATR_TIMEOUT, but this is only useful for the established connection.


    2)
    Another background program which is running parallel to my server program. This program is quite simple:

    Code
    WHILE TRUE=TRUE DO
      IF FLG[2]=TRUE THEN
        --kill server program
      ENDIF
      DELAY(500)
    ENDWHILE

    But there are 2 problems:
    a) i don't know how to kill another background task or any other program which has been started by "RUN".
    b) i would like to avoid having more background programs. But if this is the only solution....?!


    :help:

  • KAREL: Getting a list of all files in folder

    • maSu
    • February 19, 2018 at 9:39 AM

    thank you very much, now i found this function in the reference too.... :smiling_face:

  • KAREL: Getting a list of all files in folder

    • maSu
    • February 16, 2018 at 3:41 PM

    Hello,

    i would like to get a list of all files in a specific folder.

    Something like:

    Code
    ROUTINE Get_Files(folder: STRING): ARRAY OF STRING
    VAR
           all_files  : ARRAY[50] OF STRING[50]
    BEGIN
           --get the first 50 files of the folder(parameter of this function)
           --write list to all_files
    RETURN (all_files)  
    END Get_Files

    I need this because i want to delete/recreate some folders. But the content of the folders is unknown. Maybe there are some files. Maybe not.

    I use

    Code
    KCL('RMDIR fr:\data\d1',STATUS) 
    KCL('RMDIR fr:\data\d2',STATUS)
    KCL('RMDIR fr:\data\d3',STATUS)


    to delete the folders.

    Thank you very much :smiling_face:

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download