Re: [gnet] SIGSEGV + gnet_tcp_socket_get_io_channel() + HELP!



On Friday 28 May 2004 08:32, Pritish Jetley wrote:

Hi,

> i was trying out mr.helder's "hfetch" code and ran into the following
> problem. the original code ran alright, but when i tried to make it a part
> of a larger piece of code, my program crashed. i  made changes that are at
> best miniscule. here's an excerpt:
>  (snip)
>
> GLib-WARNING **: Need to set the channel buffered before setting the
> encoding.
>
> GLib-WARNING **: Assuming this is what you meant and acting accordingly.
>
> here's a stack trace:
>
> (gdb) bt
> #0  0x4201693a in __gconv_close () from /lib/tls/libc.so.6
> #1  0x42016001 in iconv_close () from /lib/tls/libc.so.6
> #2  0x4036e02f in g_iconv_close () from /usr/lib/libglib-2.0.so.0
> #3  0x4037ab97 in g_io_channel_set_encoding () from
> /usr/lib/libglib-2.0.so.0
> #4  0x40343de2 in gnet_private_io_channel_new (sockfd=14) at
> gnet-private.c:108
> #5  0x4034812a in gnet_tcp_socket_get_io_channel (socket=0x80be250)
>     at tcp.c:719
> #6  0x08050c73 in hfetch (server=0x80b8310 "202.141.81.48", port=8089,
>     filename=0x80be210 "/basic.o") at hfetch.c:132
> #7  0x08050b03 in stripURL (url_void=0x8064700) at hfetch.c:74
> #8  0x400332b6 in start_thread () from /lib/tls/libpthread.so.0
> /*******************************************************************/
>
> do i need to use glib's
> set_io_channel_encoding() & set_io_channel_buffered()
> routines?

You shouldn't need those. GNet does that automatically for you (as the stack 
trace shows as well). I don't have an explanation for your problem though I'm 
afraid - hfetch works fine here. Which GLib-2.x version and Gnet-version are 
you using?

<plug>
If you want to retrieve stuff using http, you might want to check out the 
brand-new GConnHttp module, which you can find in gnet cvs (just copy 
conn-http.[ch] into your code and adjust the includes). GConnHttp works 
asynchroneously, so you don't even need threads to achieve that.
</plug>

Cheers
-Tim




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