JF002
Posts: 94
Joined: Sat Feb 04, 2012 8:49 am
Contact: Website

Init script & connetion refused

Mon Apr 22, 2013 7:11 am

Hi,

I'm trying to automatically run an application I made at boot.
This is a GUI for LogitechMediaServer. So, my program needs LogitechMediaServer and Squeezelite to be started first. These are already successfuly started at boot time, as services.

First, I tried to add the command line in rc.local, which is run last in the init process.
It didn't work, so I tried to write an init script that run my program.

In both case, my program can't start because it can't connect to LogitechMediaServer though LMS and Squeezelite have been started just before.

It is written in python, and it tries to connect on port 9090 of the local host (using 127.0.0.1 or the local IP adress). The exception is "socket.error: [Errno 111] Connection refused".

If I try to run the same command line or init script later, after logon, my program runs without any problem.

Any explanations?

Thanks!
My web site : https://codingfield.com

JF002
Posts: 94
Joined: Sat Feb 04, 2012 8:49 am
Contact: Website

Re: Init script & connetion refused

Sun Apr 28, 2013 5:20 pm

Ok, I think I found the explaination: It seems that LogitechMediaServer needs more time to load than the time it takes to launch the service.

So, I modified my Python script to retry connecting until the connection is accepted.
My web site : https://codingfield.com

Return to “Networking and servers”