Re: [gnet] Again: timeout in Conn objects



On Friday 28 February 2003 18:38, Axel Bock wrote:

> void callback(conn, somedata)
> {
> 	do_anything;
> }
>
> 1 void somefunc()
> 2 {
> 3 	myconn = gnet_conn_new_inetaddr(...., callbackfunc);
> 4 	gnet_conn_timeout(myconn, 3000);
> 5 	gnet_conn_connect(myconn);
> 6 	SO NOW WHAT HAPPENS IN THIS CODE LINE??
> 7 }
>
>
> So The Things I Don't Understand are:
> 	- is the next line executed?
> 	- if yes: in what state is the conn object?
> 	- if no: what do I do when I have to wait for the connection??
>
>
> Help is - as always - very much appreciated and thankful accepted. ;-))
> Especially as the problem I'm tracking with this is an old one and very,
> very annoying for my work.

Nothing happens in line 6. Basically you just give control back to the main 
loop, unless you need to do other stuff as well.

Your callback will be called when something happens, and will pass you the 
status, which can be 'connected', or 'timeout' etc.

The correct declaration of the callback function is like this, btw:

gboolean
my_conn_callback (GConn *conn,  
                             GConnStatus status, 
                             gchar *buffer, 
                             gint length, 
                             gpointer user_data);


I'm not sure whether the GConn timeout is used though (has that been fixed? I 
think so, but I'm not sure).

Cheers
-Tim






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]