Listen the TCP/UDP ports and Sockets and do something with received data.
The PortListener contains:
- desktop application
- win-service / linux daemon
The PortListener boasts the following features:
- any number of TCP/UDP/Socket listeners
- display payloads as text or binary data
- make reply (no reply, echo, predefined string)
Command line arguments:
- -i (-install) Install the service.
- -u (-uninstall) Uninstall the service.
- -e (-exec) Execute the service as a standalone application (useful for debug purposes). This is a blocking call, the service will be executed like a normal application. In this mode you will not be able to communicate with the service from the contoller.
- -t (-terminate) Stop the service.
- -p (-pause) Pause the service.
- -r (-resume) Resume a paused service.
- -c cmd (-command cmd) Send the user defined command code cmd to the service application.
- -v (-version) Display version and status information.
Without arguments start the service
To send an UDP packet to port:
echo <packetContent> | socat -t 5 - udp:<dstIp>:<dstPort>
This sends the packet and prints any packets coming back from there; if none arrive, it quits after 5 seconds (-t 5).
To send an TCP packet to port:
echo <packetContent> | socat -t 5 - tcp:<dstIp>:<dstPort>
To send any packet to socket:
echo <packetContent> | socat -t 5 - UNIX-CONNECT:/path/to/any.sock
UDP packet csv-to-db example:
echo 'counters:"KBB20CQ001_D11";"1.0";"266466.2";"133233.1";"266466.0";"2023-07-18-10:47:54:222"' | socat -t 5 - udp:localhost:2424
To send modbus packet use any ModbusMasterClient. Values to test:
- [41f2 6666] -> 30.300
- [4221 999a] -> 40.400
- [4121 999a] -> 10.100