netcat is a more performant telnet application:
- it allow to use UDP transport layer.
- it allow to capture response without using
sleep (but we don't need it here).
1 Listenning and sending
There are two differents implémentation under RED-HAT and DEBIAN families.
2 Sending and receiving bytes
$ nc -u -l 1235 < hexaQuery
$ nc -u 127.0.0.1 1235 > hexaResponse
2.1 Building an hexa file
2.2 Reading an hexa file
$ hexdump hexaResponse
Warning: on PC, hexdump and tcpdump permute each block of 2 bytes (I don't know why).
IE: 23 01 67 45 should be translate as 01 23 45 67 .
3 Testing the GEDEK
Please consider this code: there is only 5 register working on the 256 allowed ?!
$ ./go
] Monitoring UDP Port 0x04d3 for registers
reg 0x00: OK
reg 0x01: OK
reg 0x02: OK
reg 0x42: OK
reg 0xff: OK
] Done !
- Capture the NECTAR outputs:
$ nc -u -l 1234 > outData
- (todo) Sending NECTAR order:
$ nc -u 192.168.1.18 1234 < inOrder
- Updating GEDEK virtuals registers:
Build the inRegister query file with these bytes:
00 FF 08 01 78 56 34 12
$ nc -u 1235 < putRegister
- Reading GEDEK virtuals registers:
Build the inRegister query file with these bytes:
00 FF 04 01
$ nc -u -l 1235 > outData
$ nc -u -l 1235 < getRegister
$ hexdump outData
0000 0104 3412 7856
|