Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Assume that I'd like to test the performance between two servers (S1 and S2) by sending multiple gigs worth of files via the DD command and a configured file share. Now, I'm trying to mimic this with streaming data via ports.
The firewall on S1 and S2 have been configured to accept all connections from port 1x.
What else is required to fully open port 1x?
Are there any commands available to create a random bunch of data (much like dd) to pass to this port?
How do I go about monitoring the port at the other side - a daemon - to then, say, convert this stream into an ever-growing file e.g. 1x-output.txt?
Thanks for the response, you've provided an excellent answer!
With regards to [2], the fact we're using netcat to send the files at source and then using netcat to receive the files and redirect to a file, this has in respect set up the "Something [that] needs to be listening for connections/data. ", correct? Or is there an additional initialisation process we still haven't done? I was expecting to set up a daemon or does the "nc -l 1234 -v" accomplish this?
I've used the dd command in the past. Obviously if the file size needed to be limited, you'd just add 'bs=[size] count=1', right ?
With regards to [2], the fact we're using netcat to send the files at source and then using netcat to receive the files and redirect to a file, this has in respect set up the "Something [that] needs to be listening for connections/data. ", correct?
This is correct, nc is the listener.
You can see this using "netstat -tnlp".
This is correct, nc is the listener.
You can see this using "netstat -tnlp".
(I have cut out some irrelevant crap from this example, but the important bits are still there)
Excellent, thanks for that. I've been doing a little bit of a testing with this and noticed it stops listening for the file once a stream stops. Is there any reason for this - I can't logically understand how it would even know a data stream has stopped unless it's keeping a timer once it starts receiving data (unless the file being sent states it's the end of the file and the listening process sees this as a stop?)? Is there a way to force it to continually listen (and output to file) until told to stop? At present I'll pass through a 1MB or 1GB file and once this ends, the listening ends. I'd like to periodically pass through data without closing the connection at the destination side.
Hopefully that question made sense. I'll gladly clarify further...
(unless the file being sent states it's the end of the file and the listening process sees this as a stop?)?
As I understand it, this is pretty much the case, except that rather than the server (listener) detecting the end of the stream, the
Quote:
Is there a way to force it to continually listen (and output to file) until told to stop?
Yes, with the "-k" option. I would suggest reading the man pages for detailed info on using nc. I don't believe you can tell it to stop from the client (sending) side with nc itself, you would have to terminate the process manually (ctrl+c, or ssh the server(listener) and kill the process).
That said, nc wont be able to distinguish the end of one stream from the beginning of the next, as far as redirecting to a file goes..
For transferring files though, scp may be a better option, (encryption, error checking, blah blah).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.