Swiss File Knife
a command line
free external tools,
- download the free Swiss File Knife Base from Sourceforge. - open the Windows CMD command line, Mac OS X Terminal or Linux shell. - OS X : type mv sfk-mac-i686.exe sfk and chmod +x sfk then ./sfk - Linux: type mv sfk-linux.exe sfk and chmod +x sfk then ./sfk OS X and Linux syntax may differ, check the help within the tool.
sfk tolog [-help] sfk tonetlog [server[:port]]|[port] Send text output of a command to terminal, and/or append it to a log file, and/or send it to a network text viewer. The log target(s) can be specified in the following ways: 1. by defining an environment variable: set SFK_LOGTO=net[:hostname[:port][,raw] set SFK_LOGTO=file:mylog.txt set SFK_LOGTO=term where targets can be combined like: set SFK_LOGTO=term,file:log.txt,net,duplex 2. by using tonetlog to force sending by network. in that case, a hostname and port can be specified as parameters. the default is to send to localhost. If no log target is specified all text goes to terminal. A recommended GUI tool to view and filter network text is Depeche View. Type sfk getdv to download, then run the tool by dview -net for instant net text display. It runs with Windows, and on Linux/Mac using WINE. parameters (with tonetlog only) server IP or name of target machine to send text to. port target port, default is 21323 (SFK UDP Text). you may also type a port without "server:". options -h[elp] print this help text (same as "sfk netlog"). -duplex request a reply for each message sent. much slower, but it is made sure that the receiver actually receives all text, which is not sure without -duplex. -timeout=n with -duplex: time to wait for a reply. default is 1000 msec. -delay=n if not using -duplex then wait so many msec after each message sent (default is 10). delay is required with longer text as receiver may fail to cache all messages. -raw send raw UDP text without sfktxt header. cannot be combined with -duplex. -toiso[=c] converts utf8 to iso-8859-1 with default character c for non-8bit codes. -nolf do not append LF after single line text. -usecr append CR instead of LF after single line text. -clear clear target log. cannot be used with -raw. -verbose tell log target if taken from environment. -recsize=n UDP max message size, default is 1000 bytes. SFK_LOGTO accepted fields term,file,net,raw,duplex,timeout,delay,toiso,nolf Send And Forget versus Duplex Transfer By default, SFK netlog sends text without checking if it arrives at receiver. This is the way that plain UDP works, and it makes sense for scripts that shall NOT slow down or even stop just because the receiver is too slow, or not present at all. However, it is NOT guaranteed that all text arrives in complete, or in the same order as sent. If text is lost you may increment the -delay, or use the -duplex option. With duplex, however, non listening or slow receivers will cause delays and error messages and may stop command execution. Working process example: remote compile scripts Type "sfk netlog -full" for example scripts how to run batch files on remote machines and view their output. see also sfk fromnet -help - print incoming network text sfk udpsend - send UDP text and binary messages sfk udpdump - print incoming raw UDP messages sfk append - append text output to a file sfk echo - for the list of possible colors sfk view - more about the text viewer program sfk samp cppnetlog - sample C++ code for sending text sfk samp javanetlog - sample Java code for sending text web reference http://stahlworks.com/sfk-netlog examples sfk echo "[Red]foo[def] and [Blue]bar[def]" +tonetlog sends colored text to a viewer on the same machine. Red with big 'R' sends bright color, 'r'ed sends dark. Type sfk getdv then dview -net to download and run the Depeche View network text viewer tool. dir | sfk tonetlog 192.168.1.100 send output of a folder listing to machine .100 set SFK_LOGTO=term,net:192.168.1.100 cl mysrc.c 2>&1 | sfk tolog sends output of a command "gcc" as UDP text both to terminal and to a text viewer running on .100 set SFK_LOGTO=term,net,duplex,timeout:3000 cl mysrc.c 2>&1 | sfk tolog similar to above, but sends output to a viewer on the local machine, asking for receipts within 3 seconds. set SFK_LOGTO=file:log1.txt,net:192.168.1.30:5000,raw sfk list mydir +tolog append filename list of folder mydir to log1.txt and send it as raw network text to machine .30 port 5000. dview -net:3000,ip runs dview on port 3000 with sender ip display. sfk tail -f mylog.txt +tonetlog .229:3000 +loop whenever mylog.txt changes, send changed text lines to a machine ending with .229 in the same subnet on port 3000. source code examples How to send network text in C++ How to send network text in Java
sfk is a free open-source tool, running instantly without installation efforts. no DLL's,
no registry changes - just get sfk.exe from the zip package and use it (binaries for
windows, linux and mac are included).
read more about all sfk functions here.