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

TCP/IP client

simover
2023-12-18
2023-12-20
  • simover - 2023-12-18

    I want to send a string to a tics TCP/IP server.
    I got i working with the Net Base lib.
    for communication good with this tcis i need to by array of byte
    I want to include a string in the third position of the array

    TCIS_Send[1] :=254; //this valus is fix for evry communication
    TCIS_Send[2] :=80; //this valus is fix for evry communication
    TCIS_Send[3] := ; here I put my and my string is lik this 5806509-DRAP10#AB#3452302073
    TCIS_Send[4] :=252; //this valus is fix for evry communication

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3

  • ph0010421 - 2023-12-19

    Hello
    TCIS_Send needs to be longer than 4 bytes because idata is 28 bytes long.
    There may be other ways, but I would make a UNION with string/array of bytes.
    Write your STRING into the AsString part then copy the AsBytes part into TCIS_Send
    (Elements [3] to [30]) then 252 would be in [31]

    (I've assumed the idata is always the same length)

     
    πŸ‘
    1

    Related

    Talk.ru: 3


    Last edit: ph0010421 2023-12-19
  • simover - 2023-12-19

    HELLO
    thank for you answer!!
    I'm a beginner can you give me an example?

     
  • ph0010421 - 2023-12-20

    Hello
    Use 'Import PLCOpenXML' to bring this into your project.

     
    πŸ‘
    1

    Last edit: ph0010421 2023-12-20
  • simover - 2023-12-20

    THANK YOU

     

Log in to post a comment.