[maemo-developers] [maemo-developers] Automatic internet connection

From: Kalle Valo Kalle.Valo at nokia.com
Date: Mon Feb 6 16:40:02 EET 2006
"Steven Hill" <steveh at shscientific.com> writes:

>> Yes, the connect dialog should be shown when the socket() call is made
>> in the application. Does your application call socket()? Are you sure
>> that LD_PRELOAD is correctly set? Could you send the complete script?
> Here is the script that I use:
> #!/bin/sh
> source /usr/bin/connectivity_preload.sh
> /var/lib/install/usr/bin/myapp

This seems to be ok.

> To test for an internet connection, I use:
>         hostent	hp = gethostbyname("www.microsoft.com");
> 	if (hp == NULL)
> 	{
> 		gtk_infoprint(GTK_WINDOW(data), "No Internet connection - use the
> Connection Manager to get one");
> 	}
> 	else ...
> Shouldn't the connection manager come up when gethostbyname is called
> and no connection to the internet is available?

The connect dialog should be shown, if there isn't any connection
established. But if there's a connection already, it will use that

For test purposes, try running socket() call before gethostbyname().
The IC preload library wraps socket() and close() functions, but
gethostbyname() should call socket(). For some reason it's not
happening now.

BTW, there is dnsmasq running on device which caches DNS queries. So
your test might give wrong answers.

For more advanced interface to Connectivity, I recommend you to use
the IC API. See the API from /usr/include/osso-ic.h and a simple
example in /usr/share/doc/osso-ic-dev/examples/osso-iap-connect.c.gz.
With the IC API you don't the preload library at all, which makes
things a bit easier.

>> But I can answer more after I see the instructions you are referring
>> to.
> Here is the section from the Maemo tutorial that refers to the
> installation:
> <<--------


> This my_application.sh is then started from the desktop file where the
> runnable binary is normally specified. Read more about desktop files
> from this earlier chapter. For you to be able to do this when developing
> on the i386 rootstrap you need to do "apt-get install osso-ic-oss" to
> have the connectivity script included in the target. See also Porting
> tutorial where an instant messenger application is ported to maemo
> platform.
> -------->>

Thanks. This is clearly wrong, it should have "apt-get install
osso-ic-lib". Maemo team, can anyone fix this?

Kalle Valo

More information about the maemo-developers mailing list