Home

mlamp

Download HTTP_Client_Example.zip

HTTP Client Example

With the function block "HTTP Client", http requests, as well as the resulting responses,
can be exchanged between a CODESYS controller and a web server.

Product description

The CODESYS software package includes a library with a function block for communicating
with a web server via HTTP.

  • When using http-GET, data is requested from a web server.
  • When using http-POST or http-PUT, data is submitted from the controller to a web server.
  • When using http-DELETE, data is deleted on a web server.
  • When using http-HEAD, http-Header is requested from a web server.

The HTTP header of a request can be extended without any restrictions. The library is included
as source code in the CODESYS package.

More information

Function block "HTTPClient"
Function block for sending http requests. The sample project HTTPClient.project illustrates
how this function block is used.

Function "URLDecoder"
Function for coding and decoding URLs (percent encoding).

System requirements and restrictions

System requirements and restrictions Info
Programming System CODESYS Development System Version 3.5.14.0 or higher
Runtime System CODESYS Control Version 3.5.14.0
Required Accessories -

Screenshot thumbnail
HTTP Client visualization in the CODESYS Development System


Discussion

  • mikek10 - 2024-07-02

    I have been using http client successfully for approximately 12 months, however in recent weeks I have begun to get TCP_INIT_ERROR when attempting to communicate. The only resolution seems to be power cycling and then the connection begins to work again for a time. I am not aware of any changes to code or libraries between working ok and now. Cold reset does not resolve, only power cycle.

     
  • mikek10 - 2024-07-03

    So it seems the error from NBS.TCP_Client is 6002 which I think is invalid_addr
    However the address is the same when working and not working?

     

Log in to post a comment.