michael105 / blog

Personal blog, connected with my websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

netcat

michael105 opened this issue · comments

This time, I had some trouble with netcat.
With nc of busybox.
This damn thing cuts data.

nc of toybox works better.
I ended with compiling a statically linked version of the original netcat, written by 'the hobbit'.
Looked into the code, I like it.

Sadly, one of the points, why the hobbit wrote netcat in 1995, did have been to prevent data being cut.
Very well. This one busybox didn't get so good.

"netcat keeps such things
religiously separated from its output and will never modify any of the real
data in transit unless you really want it to."
[...]
"Netcat was written with the Russian railroad in mind -- conservatively built
and solid, but it will get you there. While the coding style is fairly
"tight", I have attempted to present it cleanly [keeping my lines under 80
characters, dammit] and put in plenty of comments as to why certain things
are done."
(nc110.sf.net)

Oh, and I like the comments in the source..
"I'm not completely clear on how this works -- BSD seems to make UDP
just magically work in a connect()ed context, but we'll undoubtedly run
into systems this deal doesn't work on. For now, we apparently have to
issue a connect() on our just-tickled socket so we can write() back.
Again, why the fuck doesn't it just get filled in and taken care of?!
This hack is anything but optimal." :)

Andsoon..

I'm still thinking about something reasonable,
to spread those statically linked binaries.
This time, netcat is linked with uclibc.
Sometimes, uclibc bloats, sometimes musl, and in this case, minilib lacks too many things, sometimes old code (1995) is dependent on.

Since those packages are statically build, there's no problem with dependencies. In 99 percent.
Did have the idea, to keep all files of a package within one directory, and either link them into "root", or have aufs overlays.
Sometimes hard, to get a project started.
Just because the fundamental decisions will have their effects. And very often it's nearly impossible to change the basic decisions later.