Socket programming in bash (using /dev/udp)

Hi, I am trying to write 2 simple scripts. One to echo a message into a socket, and the other to read from it. There are many tutorials about, but they're mostly about retrieving web pages through a socket. The code I'm trying is

echo qwerty > /dev/udp/localhost/22 (the first port I found that didnt throw a connection refused error)

while in another terminal, I am already running

echo $(read < /dev/udp/localhost/22)

But I do not receive the message. I get the feeling I'm doing something foolish, so if anyone would be kind enough to point it out, I'd be very grateful.
Cheers.

Typically, ssh will be running on port 22. "echo $(read < /dev/udp/localhost/22)" is gibberish but let's pretend that it reads from that socket and displays a line. In that case, you established a connection to the ssh server and are reading. You would probably display a login prompt but then do nothing else. Then along comes "echo qwerty > /dev/udp/localhost/22". Here you are basicly ignoring incoming data but you sent qwerty as a login name.

When two users on the same system simultaneously do "ssh localhost", they are not in communication with each other. If you are trying to write a client and server you are in the wrong language. I don't see any way to write a server in bash.

Bash has limited provisions for socket programming. You can try C programming if you know a bit of C. Also, Perl/Python languages come with socket modules you can use for such tasks too.