![]() However, what I didn’t like about this method: I’ve used netcat for this purpose too, in the past… There are tons of other great uses for netcat out there, if you have any favorites, let us know in the comments! Both allow a user to share clipboard data as well as input devices like a mouse and keyboard.įor the record, while this demonstration is shown on two Macs with OS X, there’s no reason you can’t use netcat to send data between a Mac and Linux machine, or vice versa. It should be noted there are more convenient ways of sharing a clipboard between Macs or between a Mac and Linux or Windows machines, and in those situations you’re better off using free tools like Teleport for Mac-to-Mac input sharing, or the free Synergy utility if you’re going cross platform between Macs and PC’s. This makes it effective for one-off sending of data like log files or a big text document, but it’s not necessarily practical for moving over a lot of files.Īs already mentioned, you can pipe over just about any data, so whether it’s the output of another app, tail, cat, or even dumped directly from the clipboard with pbcopy and pbpaste, it will transfer through netcat. Once the data transfer is complete, both sides of the connection will cease and the server will stop listening, then close the port. ![]() We’ll use cat to dump a text file over the network to the listening netcat server, but you can pipe over just about anything you want:Ĭat sendthisdataover.txt | nc 192.168.1.101 2999įor this to work properly, be sure to fill in your own IP address from the server, and to cat the appropriate file or text you want to send over.Īssuming the local network is even marginally quick, the data should arrive quite fast if not instantly. Now on the client where you wish to send data from, you can use a command like the following. Pipe Data from Client (Computer 2) to the Listening Server You’ll need this on the client computer to send data over, which we’ll cover next. Let’s assume this Macs IP is reported as “192.168.1.101”, of course yours is likely to vary. If one turns up nothing, try the other interface to get the LAN IP. Modern Macs with Wi-Fi only will use en0, Macs with ethernet & wifi may use en1. You can get that from the Network control panel, or since you’re already at the Terminal, via the command line with the following syntax: We’ll launch netcat and have it listen on port 2999, and then redirect any of the data received to a file named “received.txt” with the following command string:īefore calling it done an moving over to the client, you’ll want to have the Macs IP address on the local network. Set Netcat to Listen on Server (Computer 1) & Port Situations where security is important to emphasize would be better off using SSH.įor ease, we’ll refer to computer 1 that is listening with netcat as “Server”, and we’ll refer to computer 2 sending the data to computer 1 as “client”. That obviously raises some potential for security misuse, thus using netcat to send data and text is generally best reserved for advanced users, or for use exclusively behind a protected local network where there is little risk. Note that netcat requires no logins or authentication, the only requirement is that the client is aware of the servers IP address and the listening port number.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |