echo !SR | nc 255.255.2.2 80 - how to in XP?

Hi guys I am trying to interface with an old industrial scanner through an old PC with an old network card and a copy of Linux.

It now needs to speak to a Windows XP machine, but I have no idea what the Windows equivalent of these functions would are:

echo !1 | nc 255.255.2.2 80
echo ?2 | nc 255.255.2.2 80 > list1.txt
echo ?3 | nc 255.255.2.2 80 > list2.txt
echo !4 | nc 255.255.2.2 80

Any help anyone can do to help me translate these actions would be very much appreciated.

Big thanks

Tony

I can't speak about whatever's in the rest of your script, but all four of those lines should run properly in windows CMD and/or a batch file as long as you have an nc.exe available in the current directory or somewhere in your PATH (and your network settings allow you to talk to that odd address!)

I think that "nc" must be netcat. It's a pretty common tool that just connects a TCP socket on the given port and address, writes what it's told to write, and prints whatever it gets back to terminal. (or file, when redirected like >filename). This script appears to be connecting to the device on port 80(the standard HTTP port), sending two-character commands, and sometimes saving the result it gets back from it into a txt file.

Netcat has windows ports available in many places.

Sincerest thanks Corona.

Excuse my ignorance, but is the echo important?

i.e. would
nc 255.255.2.2 80 work just as well

or is the echo an important part of the process?

Also, another section of the code uses the function stripcat e.g.
./stripcat union.txt
anyone know of this function? My preliminary search on google has proved unsuccessful.

Again - many thanks in advance.

Tony.

Here's a basic intro to shell scripting, then. "echo", even in windows CMD, just prints what you tell it to.

c:> echo !1
!1
c:> 

The netcat command reads from the terminal, that is, sends what you type into it.

Or, it can read from another program, which is what | is for. echo !1 | nc 255.255.2.2 80 prints !1 and netcat reads it, sends it over the network socket, and prints what it gets back to the terminal.

So yes, the echo is necessary, it's two commands used in concert. If you didn't feed something into it, netcat would just sit there waiting for you to type...

It's being run from the current directory, which suggests it's a custom program made for this application. Hopefully another shell script. Its name suggests it's a filter of some sort but what it actually does I can't guess, if you could post its contents that'd help a lot.