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

NBS.Write -> Invalid_Datasize

2018-10-01
2018-10-15
  • tjarcoboerkoel - 2018-10-01

    Dear Readers,

    I'm having some difficulties using the NBS lib for TCP Client application (codesys 3).

    The client connects (it gets a valid handler and xActive is TRUE) but the write function throws an error 6005 "Invalid_Datasize".
    Could someone help me out here?

    edit: The SendDataSize is set to 4.

    Best regards,

    Tjar

    IMG: CodeSys.png

     
  • tjarcoboerkoel - 2018-10-02

    Hi All,

    Well I've fixed the issue. Wasn't that hard in the end.

    Just needed to pass parameter IPaddress as string and convert this via the composer element to structure IP_ADDR.

    Strange thing is that I'm still getting Timeouts. I'm able to connect to the server using "Putty" as client, using raw TCP connection. Is functionblock NBS.TCP_Client setting up a raw TCP socket or is this using an own higher level NBS protocol?

    I cant even connect to a http server port 80.

    Best regards

    IMG: codesys2.png

     
  • johnlee - 2018-10-04

    Hi tjarcoboerkoel,

    Just want to highlight one thing to you. TCP client it does not apply for HTTP communication usage. HTTP where using Tcp/ip communication but on top of it they apply some rules. So you have no issue to connect into HTTP server with port 80 where to show you have connected in. But to expect some data to return then you have to apply http protocol.

    Thank you
    Lee Junn Hei

     
  • tjarcoboerkoel - 2018-10-15

    Hi JohnLee,

    Thank you for your reply. Yes, well.. I've now just written a tcp client in ST using TCPUDP library.
    That works just fine.

    Best regards,

     

Log in to post a comment.