Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 498
Lopper Avatar asked Jan 11 '10 09:01

Lopper


People also ask

Can netcat transfer files?

Netcat, also known as a “TCP/IP swiss army knife,” is a command-line network tool that allows you to transfer files through local networks or the Internet. It provides an easier way to transfer data without the need for additional services.

Does Netcat use TCP?

The Netcat ( nc ) command is a command-line utility for reading and writing data between two computer networks. The communication happens using either TCP or UDP.

How do I transfer files using NCAT?

A basic file transfer is very simple: Start Ncat in listen mode on one end, start Ncat in connect mode on the other end, and pipe the file over the connection. There are two ways to do this that differ only in which end listens, the sender or the receiver.


1 Answers

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
like image 109
Lopper Avatar answered Oct 05 '22 06:10

Lopper