- Code: Select all
#!/bin/sh
HOSTNAME=ad2pi.local
PORTNUMBER=10000
SAVED_STTY=`stty -g`
stty -icanon -icrnl inlcr -echoctl -echo echonl
nc $HOSTNAME $PORTNUMBER
stty $SAVED_STTY
Save this to "ad2pi.sh", then mark it executable ("chmod a+x ad2pi.sh"), and run it ("./ad2pi.sh").
This script assumes your ser2sock is listening on port 10000 on a host named "ad2pi.local"; update the values as needed.
Explanation:
This sequence of commands first saves the current TTY state so that it can restore it later, and then overrides the TTY handling of echoing and newlines. Next, the "nc" command is used to connect to the remote socket. Finally, after "nc" has exited (use Control-C to exit), the TTY state is restored.