How to use NetCat for Windows to send a binary file to a TCP connection?

Lopper picture Lopper · Jan 11, 2010 · Viewed 31.2k times · Source

If I want to transfer a binary file "binary.bin" (located in the same directory as NetCat) to IP address 127.0.0.1 port 1200 using TCP, how do I specify this using NetCat for windows?

Answer

Lopper picture Lopper · Jan 12, 2010

I found the solution. Its

nc 127.0.0.1 1200 < binary.bin

In addition, if the response needs to be saved then

nc 127.0.0.1 1200 < binary.bin > response.bin