User Tools

Site Tools


webapi:implementations:udp

This is an old revision of the document!


Titan Web-API

WebAPI over UDP

By design, the Web API works with HTTP requests - and HTTP is bound to TCP (this is about network protocols - if you don't know what this acronyms mean then this topic isn't interesting for you :-)). You may come across situations where you need to control Titan from UDP requests, e.g. when working with particular main control suites.

While it is not possible to simply fire the same request as UDP string onto Titan, it is very well possible to run a little program like socat, which - when started with proper parameters - forwards UDP strings as TCP requests. The only other thing is that you need to send a complete HTTP request string.

1. Get Socat

2. Start Socat

Run Socat on the same computer like Titan, with proper parameters. In my example it worked when called like this in a console window:

socat udp4-listen:9090,reuseaddr TCP:192.168.178.59:4430

The parameters I used are

  • udp4-listen:9090 – this tells socat to listen to UDP messages, on port 9090, in IPv4 protocol
  • reuseaddr – allowas other sockets to bind to the same address (I found this helps avoiding some issues)
  • TCP:192.168.178.59:4430 – this tells where and how socat forwards the messages to, in out case, as TCP requests, to the IP of the Titan PC (the same computer socat is running on), on port 4430 (the port Titan listens on)

When everything is setup properly then socat just sits there and does its job, without any visual feedback. However when debugging or looking for a particular issue it might help to start socat with some debug output, using the option -v

socat -v udp4-listen:9090,reuseaddr TCP:192.168.178.59:4430

This outputs the transferred data to you screen, and help in finding possible faults.

You can also start socat with the hostname instead of the IP address, like this:

socat udp4-listen:9090,reuseaddr TCP:localhost:4430

In order to terminate socat simply use

Ctrl-C
webapi/implementations/udp.1738225655.txt.gz · Last modified: 2025/01/30 08:27 by icke_siegen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki