Before I go any further, let me state that this is based on something I discovered here on Dave Smith's Blog. All I've done here is added a few improvements based on the comments to the original post. I've also added a bit of additional explanation...
September 30, 2009
More on Using Bash's Built-in /dev/tcp File (TCP/IP)
If you saw yesterday's Tech Tip and were looking for more on using TCP/IP with bash's built-in /dev/tcpdevice file then read on. Here, we'll both read from, and write to a socket.