{"id":6842,"date":"2014-04-23T08:12:01","date_gmt":"2014-04-23T08:12:01","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/problem-about-netcat-collection-of-common-programming-errors\/"},"modified":"2014-04-23T08:12:01","modified_gmt":"2014-04-23T08:12:01","slug":"problem-about-netcat-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/23\/problem-about-netcat-collection-of-common-programming-errors\/","title":{"rendered":"problem about netcat-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1d2f461b741cedfc550fb674b9bb3432?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2307181<br \/>\nandroid tcp raspberry-pi iptables netcat<br \/>\nHello im new in linux and android programming , my idea is send packet data from Raspberry Pi to Android Phone via TCP socket. .When connection started, the data stream well , after few data sent the streaming sometimes &#8220;jammed&#8221;. My android phone IP 192.168.43.1 My static Raspberry IP 192.168.43.5I try to change the port number but the connection still jammed, I try to reduce the size of the packet data but also still jammed .I assume the raspberry firewall (if it exist) is the problem Or maybe<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ed31503abe430abcd04be91c89b723f7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbaptx<br \/>\nsockets unix debian netcat<br \/>\nThis question is following this one: Sockets working in openSUSE do not work in Debian?When working with sockets on my Debian system, I have to use nc -l -p port_number to simulate the server I want to talk with. If I&#8217;m using nc -l port_number, it will fail when using the socket connect function and strerror(errno) will say &#8220;Connection refused&#8221;.Netcat without -p option is working great on other Linux distributions, what should I change on my configuration?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/100001429257343\/picture?type=large\" \/><br \/>\nFighterWks<br \/>\nshell syntax syntax-error sh netcat<br \/>\nHello i have a problem in this script This feature is apparently bad but how to fix it?nc -z -v ip adress port if connect to ip adress port 13000 (tcp) failed: Connection refused then cd \/usr\/home\/game\/ .\/game else exit fierror :5: Syntax error: &#8220;(&#8221; unexpected (expecting &#8220;then&#8221;)<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/66c536d7add21c306351faf30b21475f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLuis Daniel Rubiera<br \/>\nlinux scripting netcat busybox<br \/>\nIm new in netcat, but im trying to use the same line in the busybox, as i do in my pc, i want to know how can i change de redirection operator.nc -w 30 IP 3031 -e &lt;&lt;&lt;&#8220;info&#8221;this is the error-sh: syntax error: redirection unexpectedi think it doesnt like &lt;&lt;&lt;, but should i switch it for what :\/ ?many thanks!btw this script trows the information it get to the screen, by sending &#8220;info&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9ccdeef3a9cce3d078f801a092aa40a3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nheavyd<br \/>\nlinux udp netcat<br \/>\nI am using netcat on some Linux machines (see this other question), but seeing some unexpected behavior.Unlike the guide in the accepted answer, I am not using UDP tunneling to do DNS queries. I have a remote server that I can log into, but not install software on, and I&#8217;m trying to tunnel UDP traffic from my computer to the server, and then setup a separate tunnel to send UDP responses back from the server to my machine.The tunnel going from my machine to the server is working perfectly, howev<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8b063cad2e87a92e1e8a44c58ccf9949?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nZek<br \/>\nlinux centos relay netcat<br \/>\nI have a legacy database application that can be accessed via ODBC on port 3000. I have set up a simple netcat relay on a bastion host so that this ODBC access can be done via the bastion host:while true ; do nc -n 192.168.1.2 -l 3000 0&lt;backpipe | nc -n 192.168.1.3 3000 1&gt;backpipe ; done 192.168.1.2: bastion host (CentOS 6.x [64]) 192.168.1.3: legacy server with ODBC service on port 3000 (Redhat EL 3.x)It works (kinda), but it is not reliable. What happens is that I often get errors and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/75404230bb6991027394855068b0e487?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsmagch<br \/>\nnode.js sockets tcp netcat<br \/>\nI want to compile some markdown posts thorough netcat. Here is Makefile.# Makefileall: $(POSTS)$(POST_DEST_DIR)\/%.html: $(POST_SRC_DIR)\/%.md | $(POST_DEST_DIR)@nc localhost 3000 &lt; $&lt; &gt; $@@echo &#8216;compiled $@&#8217;.DELETE_ON_ERROR: $(POSTS)When TCP server exit with error, nc exit without error while Node.js nc wrapper exit with error. Here is a Node.js wrapper script.\/\/ nc.jsvar client = require(&#8216;net&#8217;).connect(3000); process.stdin.pipe(client); client.pipe(process.stdout); client.on(&#8216;error&#8217;, fu<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b80f97305f07eb9f8a34d33fbfaf7700?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nA.Rashad<br \/>\nc makefile aix netcat<br \/>\nI have been trying to compile netcat.c on AIX for some time (using the command make aix), but the compiler gives me some weird feedback such as :&#8221;netcat.c&#8221;, line 117.12: 1506-275 (S) Unexpected text &#8216;int&#8217; encountered.when checked the file netcat.c at line 117, I would find the line (second line in code below):#ifdef HAVE_BIND extern int h_errno; \/* stolen almost wholesale from bsd herror.c *\/even if I changed the int into char for the same of testing, save the file and re-run the command I get t<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6eebf46a01024f17e341e00d380ef26a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nStriketh<br \/>\ncentos kernel netcat kernel-panic<br \/>\nI&#8217;ve gotten netconsole setup on a server that&#8217;s been having a variety of kernel panics lately and I&#8217;m trying to log kernel messages to another server. I&#8217;ve tested netconsole after setting it up on the host server by start a netcat session and typing in some random bits of data. These arrive on the capturing server without any issue and I&#8217;m able to view the text in the log file I have setup.However, nothing that is being logged in dmesg (i.e. kernel messages) is being forwarded to the capturing s<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0a7abcf0718b2391335f11f7c6b2065b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nscttnlsn<br \/>\nsockets node.js tcp telnet netcat<br \/>\nI am issuing newline-separated text commands to a custom protocol TCP server. In the example below I issue 2 commands and receive a response written back. It works as expected in telnet and netcat:$ nc localhost 1234 command1 command2 theresponseThe same workflow is not working when connecting with Node.js:var net = require(&#8216;net&#8217;); var client = net.connect(1234, &#8216;localhost&#8217;);client.on(&#8216;data&#8217;, function(data) {console.log(&#8216;data:&#8217;, data.toString()); });client.on(&#8216;error&#8217;, function(err) {console.lo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/28a90e64dc8cd864b368585afd2b52de?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGrezzo<br \/>\nlinux port nmap netcat<br \/>\nI&#8217;m trying to get netcat to listen on port 4444, but it doesn&#8217;t seem to be working. I am checking to see if the port is open using nmap, but it doesn&#8217;t pick it up and I can&#8217;t figure out why. I have tried various ports with no joy.Here is a copy of my terminal so you can see what I am doing and what I have tried:#iptables -LChain INPUT (policy ACCEPT) target prot opt source destinationChain FORWARD (policy ACCEPT) target prot opt source destinationChain OUTPUT<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/09bdb599c807667417ed4e79467afa79?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nFrank Science<br \/>\nvim lisp scheme netcat<br \/>\nMy operating system is Debian Squeeze. Here&#8217;s the vim version:VIM &#8211; Vi IMproved 7.2 (2008 Aug 9, compiled Jul 12 2010 02:29:33)I read a tutorial on http:\/\/kovisoft.bitbucket.org\/tutorial.html and tried to start REPL for MIT-Scheme. Unfortunately, I failed to start.When I pressed &#8220;,c&#8221;, it started a terminal window loading mit-scheme. Nothing showed in the REPL buffer of vim. Some errors showed in the terminal:Listening on port: 4005 ;netcat: &#8220;4005: inverse host lookup failed: Unknown host&#8221; ;To co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9b6c8b04130af49735de5be666d67c00?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMichael Foukarakis<br \/>\nimage bash http netcat<br \/>\nI&#8217;m trying to write a little HTTP server using netcat. For plain text files this works fine but when I try to send a picture, the browser displays only the icon for broken images. What I do is extracting the mime-type and size of a requested file and cat it to the client. The header of a request of my example picture looks like this:HTTP\/1.0 200 OK Content-Length: 197677 Content-Type: image\/jpegThis is my bash script which I launch with -e option of the netcat tool:#!\/bin\/bash# &#8212; OPTIONS index<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>user2307181 android tcp raspberry-pi iptables netcat Hello im new in linux and android programming , my idea is send packet data from Raspberry Pi to Android Phone via TCP socket. .When connection started, the data stream well , after few data sent the streaming sometimes &#8220;jammed&#8221;. My android phone IP 192.168.43.1 My static Raspberry IP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6842","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6842"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6842\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}