nuttx-apps/netutils/netcat
Alexander Lunev e317d32fe1 netutils/netcat: fixed crash on accept() invocation.
Sometimes netcat in server mode crashed with "psock_accept: ERROR: si_accept failed: -9".
And sometimes it crashed with "up_assert: Assertion failed at file:inet/inet_sockif.c line: 841 task: netcat".
2022-02-10 12:20:27 +08:00
..
Kconfig netutils/netcat: implemented NETUTILS_NETCAT_BUFSIZE option. 2022-01-25 00:47:34 +08:00
Make.defs netutils: fix relative path CI error 2021-06-16 09:03:06 -05:00
Makefile netutils: fix relative path CI error 2021-06-16 09:03:06 -05:00
netcat_main.c netutils/netcat: fixed crash on accept() invocation. 2022-02-10 12:20:27 +08:00
README.md netutils/netcat: Add netcat tool 2020-11-17 09:12:54 -08:00

Network Utilities / netcat tool

netcat TCP/IP Swiss army knife

It was re-implemented from scratch for NuttX

DEMO

weboftwins-osvehicle-2020-rzr

USAGE

Usage is straightforward:

nsh> help ; netcat
Usage: netcat [-l] [destination] [port] [file]

nsh> renew eth0 ; ifconfig

eth0    Link encap:Ethernet HWaddr 52:13:FF:FF:FF:FF at UP
        inet addr:192.168.1.42 DRaddr:192.168.1.254 Mask:255.255.255.0

In the following examples, following configuration is used:

  • target (nuttx) is 192.168.1.42
  • host (linux) is 192.168.1.55

Server

As a server on NuttX and Linux's netcat as client

nsh> netcat -l

sh> cat /proc/version | netcat 192.168.1.42 31337
Linux ...

Default port is 31337 but it can changed.

nsh> renew eth0 ; ifconfig ; netcat -l
log: net: listening on :31337
Linux ...

Client

Start Server on GNU/Linux:

sh> ip addr show && netcat -l 31337

Client side on nuttx, we create

nsh> help ; renew eth0 ; ifconfig
nsh> netcat 192.168.1.55 31337 /proc/version

Using pipes

mkfifo /dev/fifo
netcat 192.168.1.55 31337 /proc/fifo
help > /dev/fifo

fxos8700cq > /dev/fifo &
fxos8700cq [7:100]
netcat 192.168.1.55 31337  /dev/fifo

Resources