[Contiki-developers] Help with border router and TCP server

709 views
Skip to first unread message

Patricia Elizabeth Figueroa Millán

unread,
Oct 4, 2011, 1:38:06 AM10/4/11
to contiki-d...@lists.sourceforge.net
Hi everyone.
I am trying to build a TCP server in cooja.
I set up a border router in cooja using border-router.c and a node with my tcp socket server following the example example-psock-server.c.
I compille succesfully the simulation and all seems to work but when I do : make connect-router-cooja  I get the following error:

sudo ../../tools/tunslip6 -a 127.0.0.1 aaaa::1/64
client: connect: Connection refused
tunslip6: can't connect to ``127.0.0.1:60001'': Connection refused
make: *** [connect-router-cooja] Error 1


I compile it for minimal-net and it is working. I only add the aaaa:: prefix. And I can read in a client socket in java the message  "Welcome, please type something and press return.\n" that the server sends to the client.

This is the Makefile (it is based on the rest-server-example):

all: patty
#The Makefile will include the Contiki Make structure and automatically compile your project.
CONTIKI=../..

ifndef TARGET
TARGET=sky
endif

WITH_UIP6=1
UIP_CONF_IPV6=1

CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"

include $(CONTIKI)/Makefile.include

$(CONTIKI)/tools/tunslip6:    $(CONTIKI)/tools/tunslip6.c
    (cd $(CONTIKI)/tools && $(MAKE) tunslip6)

connect-router:    $(CONTIKI)/tools/tunslip6
    sudo $(CONTIKI)/tools/tunslip6 aaaa::1/64

connect-router-cooja:    $(CONTIKI)/tools/tunslip6
    sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 aaaa::1/64


Any help?
What its happening with cooja and tunslip6?
Why I can run succesfully with minimal-net?.
What means this error?

Thanks in advance.
--
Patty Figueroa.

Patricia Elizabeth Figueroa Millán

unread,
Oct 4, 2011, 1:57:17 AM10/4/11
to contiki-d...@lists.sourceforge.net
Seems that it is a problem with "siodev" because when I do a "make
connect-router" I get the following error:

sudo ../../tools/tunslip6 aaaa::1/64
tunslip6: can't open siodev: No such file or directory
make: *** [connect-router] Error 1

How I can solve these problems? Please I need help!! :'(

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Contiki-developers mailing list
Contiki-d...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/contiki-developers

Patricia Elizabeth Figueroa Millán

unread,
Oct 4, 2011, 2:31:39 AM10/4/11
to contiki-d...@lists.sourceforge.net
I found that with cooja it is not setting up "tap0". And for this I can make
connect-router-cooja . But why with minimal-net everything is working?.

Thanks for any help that you can provide me!!!

Benjamin Beichler

unread,
Oct 4, 2011, 3:40:53 AM10/4/11
to Contiki developer mailing list
Hi,

I think you should check the port. When you open the tcp socket server in cooja, the port is printed in the window.

The other things you tried, are not working, because they use a serial device, which cooja won't create.

kind regards

Benjamin
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1

Mohammad Abdellatif

unread,
Oct 4, 2011, 8:40:34 AM10/4/11
to Contiki developer mailing list
when u open a serial connection on  a node in cooja, it opens a connection on the port 127.0.0.1:6000x where x is the node id
so in order to be able to connect to a node in cooja.. make sure to use the correct port after opening the serial connection to it by using the command
tunslip6 -a 127.0.0.1 -p 6000x aaaa::1/64
to answer your other question, tunslip6 creates the connection to tun0 by default. if u want to create tap0 interface then use the option -T with tunslip6
or -t tapx or tunx


Mohammad Abdellatif

Phd student at Faculty of Engineering University of Porto (FEUP)
Researcher at Inesc Porto, UTM, WiN 

Patricia Elizabeth Figueroa Millán

unread,
Oct 7, 2011, 11:14:55 PM10/7/11
to contiki-d...@lists.sourceforge.net
Hi Mohammad Abdellatif and Benjamin Beichler!

Thanks for responding to my questions.
I check the simulation and the Border Router is listenning on port 60001 and the
other node with the TCP server is listening in 60002 port.

I change the command for tunslip6 to:
tunslip6 -a 127.0.0.1 -p 60001 aaaa::1/64
in the Makefile.

But I am still getting the same error.

I run the rest-server-example looking for a solution and the terminal prints out
this:

user@instant-contiki:~/contiki-2.x/examples/rest-example$ make TARGET=cooja
rest-server-example.csc
java -mx512m -jar ../../tools/cooja/dist/cooja.jar
-quickstart='rest-server-example.csc' -contiki='../..'
INFO [main] (GUI.java:1156) - > Starting COOJA
INFO [main] (GUI.java:2649) - External tools default settings:
/external_tools_linux.config
INFO [main] (GUI.java:2679) - External tools user settings:
/home/user/.cooja.user.properties
INFO [main] (Simulation.java:409) - Simulation random seed: 123456
INFO [main] (CompileContiki.java:124) - > make border-router.sky TARGET=sky
INFO [main] (CompileContiki.java:124) - > make rest-server-example.sky TARGET=sky
INFO [main] (MspMote.java:253) - Loading firmware from:
/home/user/contiki-2.x/examples/ipv6/rpl-border-router/border-router.sky
INFO [main] (MspMote.java:253) - Loading firmware from:
/home/user/contiki-2.x/examples/rest-example/rest-server-example.sky
INFO [main] (MspMote.java:253) - Loading firmware from:
/home/user/contiki-2.x/examples/rest-example/rest-server-example.sky
INFO [main] (SerialSocketServer.java:120) - Listening on port: 60001


But in my application when I run the simulation I am not getting the INFO [main]
(SerialSocketServer.java:120) - Listening on port: 60001 (see below). Why this
can happen? Why the serial socket server in my simulation is not working?.

-----------------------------------------------------------------------------

user@instant-contiki:~/contiki-2.x/examples/patty$ make TARGET=cooja servidor.csc
java -mx512m -jar ../../tools/cooja/dist/cooja.jar -quickstart='servidor.csc'
-contiki='../..'
INFO [main] (GUI.java:1156) - > Starting COOJA
INFO [main] (GUI.java:2649) - External tools default settings:
/external_tools_linux.config
INFO [main] (GUI.java:2679) - External tools user settings:
/home/user/.cooja.user.properties
INFO [main] (Simulation.java:409) - Simulation random seed: 123456
INFO [main] (CompileContiki.java:124) - > make border-router.sky TARGET=sky
INFO [main] (CompileContiki.java:124) - > make servidor.sky TARGET=sky
INFO [main] (MspMote.java:253) - Loading firmware from:
/home/user/contiki-2.x/examples/ipv6/rpl-border-router/border-router.sky
INFO [main] (MspMote.java:253) - Loading firmware from:
/home/user/contiki-2.x/examples/patty/servidor.sky


Thanks for any help :)


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2

Patricia Elizabeth Figueroa Millán

unread,
Oct 7, 2011, 11:24:26 PM10/7/11
to contiki-d...@lists.sourceforge.net
Ohh sorry and thanks for your help!! I realize that I did not add the serial
socket server plugin to my simulation. :S Now it is working!!! Thanks a lot!

Patricia Elizabeth Figueroa Millán

unread,
Oct 8, 2011, 12:25:39 AM10/8/11
to contiki-d...@lists.sourceforge.net
I have another question if anyone can help me.
Well now I can connect with cooja. But when the prefix aaaa:: is added it is
only added to the border router and the other node that I have with ID 2 don't
change the prefix to aaaa:: why this happen?

In the rest-example when the prefix is added this is added to all nodes and I
can communicate with all nodes. But in my simulation the prexix only changes in
the border router and the TCP server (NODE with ID 2) don't and I need to
communicate with it!

Any help?
How I set up to all nodes the aaaa::prefix?

cyril auburtin

unread,
Oct 8, 2011, 5:33:06 AM10/8/11
to Contiki developer mailing list
Hello can I ask if there is a benefit of running tunslip with tap interface instead of tun?

or is there a possibility to use tap interface in cooja sims, like it is done with minimal-net target, I mean just running radvd and adding the routing entry for the prefix

thanks


quangn...@gmail.com

unread,
Feb 12, 2015, 9:06:36 AM2/12/15
to osdeve_mirror_rtos...@googlegroups.com, contiki-d...@lists.sourceforge.net, a011...@itesm.mx
Remember to turn on Serial Socket (SERVER) in your server mote (right click the server mote and select “Mote tools for sky -> Serial socket (SERVER)). Do not click the x symbol the a pop-up comes out. At the same time, open another terminal and type sudo ../../tools/tunslip6 -a 127.0.0.1 aaaa::1/64. It should be working now!

Vishal Rathod

unread,
Jun 29, 2022, 5:46:49 AM6/29/22
to osdeve.mirror.rtos.Contiki-developers
Hello,

I am trying to run the example-psock-server.c with border router. I have opened the socket communication with make connect-router-cooja.

But still got the message could not establish the connection error. 

Any pointer?

Regards,
Vishal

Reply all
Reply to author
Forward
0 new messages