Corning Community College
CSIT2320 HPC Systems and Networking
Assignments, Documents, Information, and Projects
We looked at another (potentially concurrent approach, if some want to also continue working on the Raspberry Pi GPIO approach from last semester) means of going about the morse code project, using netcat and utilizing socket communications.
Two simple one liners get us functionality as a listener (receiver) and a sender.
machine:~$ netcat -l 34070 -k
$ echo "dit dit daw dit" | netcat machine 34070
These simple examples started giving way to a scripted approach allowing for additional sophistication.
Following the first instance of a listener script, which parses the received information and potentially acts on it:
#!/bin/bash -x # # listener # while [ true ]; do input="`netcat -l 34077 2>&1`" case "${input}" in echo) echo "echo" ;; peng) echo "pong" | netcat pod00.offbyone.lan 34076 ;; help) echo "usage" ;; quit) exit 0 ;; esac done
This demonstrated the functionality.
We ended up establishing a simple routing path where a ping was pong'ed then pang'ed and finally peng'ed. We even tried making a closed loop, which DID work for a few rounds (2-3). The nature of how were doing this has a time vulnerability where upon receiving information the socket is down (as netcat exits, until it starts back up again– but that does leave a couple millisecond gap where something could be missed).
We need to come up with an address map- positions where people will take up, where immediate next neighbors are known, so we can better explore the routing implications with a network of connected communication hubs.