[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwip minimal example, echo server

From: Sergio R. Caprile
Subject: Re: [lwip-users] lwip minimal example, echo server
Date: Fri, 03 Oct 2014 10:27:27 -0300
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

OK, here I go...
The UN*X examples use a tun/tap device, and there is a specific
configuration parameter for different flavors of it. Check the Makefile
for this, did you ?
#To compile for linux: make ARCH=linux
#To compile for cygwin: make ARCH=cygwin
#To compile for openbsd: make ARCH=openbsd
Once you have the correct tun or tap device, it will show up in your
ifconfig and you will be able to ping the lwIP stack as a new machine on
a new network, which is what you should do first when debugging
networking problems.

In main.c:
  /* startup defaults (may be overridden by one or more opts) */
  IP4_ADDR(&gw, 192,168,0,1);
  IP4_ADDR(&ipaddr, 192,168,0,2);
  IP4_ADDR(&netmask, 255,255,255,0);

So, will be the address of the gateway in your machine to
"the lwIP network", via a tun or tap interface. In Linux seems to be tap

tap0      Link encap:Ethernet  HWaddr 86:99:D8:CE:27:DC
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::8499:d8ff:fece:27dc/64 Scope:Link
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)

The specifics to get the tap working are beyond my knowledge, I remember
I just followed a tutorial. The interface will be up once the example is
running, and will dissappear after that.
Anyway, you should be able to ping that interface to check if the tap is

And,  will be your "lwIP machine" address, you should be
able to ping it

address@hidden minimal]# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=255 time=8.76 ms
64 bytes from icmp_seq=2 ttl=255 time=9.66 ms

--- ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 8.766/9.214/9.663/0.458 ms

and you should be able to telnet to it in port 7, cause no one knows if

SimpleEchoClient really works, although you probably will.

address@hidden minimal]# telnet 7
Connected to
Escape character is '^]'.

You probably noticed I run this as root... there are some permissions
associated to the tap interface, and I'm lazy enough to change them.
Anyway, you should see something like this:
tapif: tapif_init: open: Permission denied
if that is the case.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]