How does netcat manage the data it transfers ?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How does netcat manage the data it transfers ?
# 1  
Old 08-31-2009
How does netcat manage the data it transfers ?

Hi all,

When using netcat to transfer the data over socket, if no connection is established, how long will netcat keep the data; will it discard the "oldest" data ?

Say for example I use "Some Command | netcat -l -p port", the command I use will generate a lot of output constantly, while no connection is established yet, will netcat discard the "oldest" data so after the connect is finally established, I only see the latest data ?

I suspect it should work in this way. If yes how do I set the buffer size ? If no how does it work then ?

Thanks!
# 2  
Old 08-31-2009
Hi qiulang Only thing I somewhere read about netcat is:

If you want transfer file between machines you type
reciever# nc -l p 8000 > /home/user/destination
sender# nc reciever 8000 < /home/user/source
But if somebody else start to send packets to reciever:8000 they will be ignored (cause it is TCP comunucation and session has been established previous)
Maybe it will help you

---------- Post updated at 11:37 AM ---------- Previous update was at 11:27 AM ----------

also found tool called netcat++ socat
# 3  
Old 08-31-2009
8k

Thanks for replying although this was not what I was looking for.

I find from here Netcat: the TCP/IP swiss army saying that "Data from the network connection is always delivered to standard output as efficiently as possible, using large 8K reads and writes."

So I guess 8k is the buffer size and if data is bigger than 8k while connect has not been established, the "oldest" data will be discarded. Can anyone confirm ?

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to fix and manage data in rescue mode?

Hello, I am running ubuntu 14.04 My server has problems again. I need to manage system files in rescue mode, backup some files, edit /etc/crontab and rc.local files etc. root@rescue:~# cat /proc/mdstat Personalities : md2 : active raid1 sda2 sdb2 4193216 blocks md3 :... (4 Replies)
Discussion started by: baris35
4 Replies

2. Emergency UNIX and Linux Support

Netcat ( nc -l ) as webserver

Dear Linux guru's I am trying to create a webserver using nc (netcat only) on RHEL 7.2 running on bash shell. now the easy thing is to get nc listing to a port and respond back $ while true; do { echo -e 'HTTP/1.0 200 OK\r\n'; set; } | nc -l 7877; done This when called from a... (3 Replies)
Discussion started by: chakrapani
3 Replies

3. IP Networking

Help with Netcat

Hi all, I know my question is regarding Windows and not Linux, but I simply need people who know Netcat pretty well and I'm guessing here is a good place for that. So on with my question. I'm doing some research, and I was playing around with netcat on a WinXP VM but I can't seem to get... (0 Replies)
Discussion started by: MrCrumbs
0 Replies

4. Shell Programming and Scripting

Post using nc(netcat)

Hi; I have a url like http://localhost:8080/examples/jsp/dates/nextPageToPost.jsp?name=ajay&password=pas&sex=Male&check=on&nationality=USA&description=aa&submit=submit in which i want to use nc for http post for parameters like "name","password"....etc can neone please help me how to do that... (3 Replies)
Discussion started by: ajaypadvi
3 Replies

5. Linux

Thank you radoulov for your help on netcat command (nc -lp)

Hello, Thank you very much for the line nc -lp <port> . I tried to run simple chat session with nc as it's shown in catonmatDOTorg but failed miserably with that syntax inspite of opening port 7777 by iptables . But your command example is working nicely. So a bagful of thanks :)) Only one... (0 Replies)
Discussion started by: vectrum
0 Replies

6. Ubuntu

Data Transfers Lock System Up Completely

I have two laptops on which I've installed Ubuntu Studio 9.04. The first laptop (Acer) has a Centrino 32-bit Intel CPU in it and the second (HP) has a 64-bit dual core Intel CPU. I'm running the 32-bit version of Ubuntu Studio on the Acer and the 64-bit version on the HP. While testing the... (5 Replies)
Discussion started by: deckard
5 Replies

7. Shell Programming and Scripting

netcat

Is there a way how to react on the message a client sent to the server? I would like as the client sent message to server: "get information such and such" and server would answer. Thank you for reply! (6 Replies)
Discussion started by: MartyIX
6 Replies

8. UNIX for Advanced & Expert Users

Netcat with Authentication?

I'd like to do a data transfer without encryption but with a guarantee that my data comes from a legit source. I'm thinking something that uses a public key scheme to sign the data. Does anyone know of something like that? Thanks! -Pileofrogs (1 Reply)
Discussion started by: pileofrogs
1 Replies
Login or Register to Ask a Question