0

I have a shell script which starts a simulation environment (ROS together with Underwater Simulation) on Ubuntu 12.04. In order to use the simulation environment in general ones component needs to communicate with the environment via TCP/IP.

If I start the script for the simulation on a standard terminal the simulation environment starts like it's supposed to. It also binds to a previously defined IP address, no errors or warning. I can work with it without any limitation. Now here comes my problem: I need to start the simulation in a detached screen (do to requirements). I use

screen -d -m -S UWSim bash -c 'export $USER=~ ; ~/uwsim_ws/uwsim_starter.sh'

I need to set the USER variable which is not set by default in a screen, otherwise the script doesn't find other subscripts of ROS. After executing the command above, at some point during the startup of ROS I get the following error:

...
Traceback (most recent call last):
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address
...

Due to this error my components can't connect to the simulation. As I already mentioned: everything works perfectly when started in a standard terminal. My guess is that there are some export's missing. I already compared all exports in the terminal with the exports in the screen (this led me to set the USER variable), without any success.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Westranger
  • 1,308
  • 19
  • 29

2 Answers2

0

I would do anything shell-related in the uwsim_starter.sh shell instead of inside your screen command. Thanks to that, your screen command would be simpler

then export $USER is NOT supposed to set $USER to anything ! use

export USER=~ 

instead

Also, Cannot assign requested address usually appears when another process is already listening at the same ip:port or *:port on the same server. Please check that using

netstat -plnt | grep <port number of your application>

and search for someone else in LISTEN mode

0

It tourned out, that the script tries to bind to an IP address which was not assinged to any NIC. When I start the script outside of a screen it uses localhost (like supposed), when startet inside, it uses some default address (no idea where this comes from). Anayway, thanks everybody for your feedback

Westranger
  • 1,308
  • 19
  • 29