[maemo-developers] [maemo-developers] "Smartest" way to start network connection "before" socket connection is attempted to be made

From: Tomi Ollila tomi.ollila at guru.guru-group.fi
Date: Fri Mar 10 10:34:51 EET 2006
Kalle Valo <Kalle.Valo at nokia.com> writes:

> "Tomi Ollila" <tomi.ollila at guru.guru-group.fi> writes:
>
>> In a program I need to know the IP of the interface before doing
>> any network connections. 
>>
>> So far the program has complained 'Please start network connection first'
>>
>>
>> But I'd like to have smarter solution, like do the automatic network
>> connection that LD_PRELOAD -trick does but not to connect anywhere.
>>
>> Does anyone know a good way to achieve this, so that the network connection
>> stays alive and closes on request, or when the program exits (unless there
>> is someone else using the connection...).
>
> What do you exactly want to do? I didn't get it from your description,
> sorry. You want to start the network connection but not connect
> anywhere. What do you mean by that?

I am setting up IPsec policies in a shell script with setkey (from
ipsec-tools, on custom kernel as root), from local ipt o remote ip. 
setkey does not call socket() or anything.

The shell script is run by GUI program so the "reference" to the thing
that keeps network connection is best kept there so that the lifetime
is long enough.

> To answer your question in subject ("Smartest" way to start network
> connection "before" socket connection is attempted to be made), I
> would say use the IC API. That they you don't have to deal with
> sockets at all during the connection establishment.

I'm now using osso_socket() and osso_close(). That works well enough for
now :D

> -- 
> Kalle Valo


Tomi

More information about the maemo-developers mailing list