Version 7 of netcat

Updated 2012-11-07 22:33:30 by jbr

http://netcat.sourceforge.net

From the web site:

Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol. It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.

Also see: http://en.wikipedia.org/wiki/Netcat


JBR 2012-11-06

I was using netcat on ubuntu linux to send some commands to a sever and get the return data into my processing pipe. The server can take some time to compute the annswer (an image) and responde, soI wanted the client (nc) to wait forever for the data after reading the commands from stdin. I used the "-q" flag with -1 as a argument. Now sitting at home on my MacBook, I find that the OS X version of netcat doesn't have this flag. I poked around on the net to see if I could find the Ubuntu versions's source but I haven't found it yet.

I thought that it should be easy enough to do what I want in Tcl. So I wrote this, but it doesn't work either, it won't read any lines fron stdin:

#!/usr/bin/env tclkit8.6
#

set host [lindex $argv 0]
set port [lindex $argv 1]

set sock [socket $host $port]
fconfigure $sock -translation binary

fcopy $sock stdout -command exit


while { [gets stdin line] >= 0 } {
    puts $sock $line
}
close $sock w

vwait forever