Re: [gnet-dev] last patch
- From: Ian Peters <itp ximian com>
- To: David Helder <dhelder umich edu>
- Cc: gnet-dev gnetlibrary org
- Subject: Re: [gnet-dev] last patch
- Date: 16 Sep 2002 10:38:00 -0400
To replicate the very sane behavior from glib 1.2, rather than the
obnoxious glib 2.0 defaults, you need
channel = g_io_channel_unix_new (fd);
g_io_channel_set_encoding (channel, NULL, NULL);
g_io_channel_set_buffered (channel, FALSE);
By default, glib 2.0 channels are utf-8 encoded and buffered, and only
channels with a NULL encoding may be unbuffered, so it must be set in
that order. The third parameter to _set_encoding is for a GError, and
the ignored return value is a GIOStatus, but setting the encoding is
guaranteed to work for a newly created channel.
Thanks for the library, btw, you've helped me keep a safe distance from
the always-enjoyable world of unix network programming. Hope this
helps.
Ian
On Mon, 2002-09-16 at 10:27, David Helder wrote:
> GNet is built against 1.2 or 2.0, so we could either have a #define or
> function. It requires a variable, so a function would be best
> (like gnet_private_iochannel_new()).
>
> Does calling g_io_channel_set_encoding() change the semantics any? That
> is, will the iochannel in 2.0 behave just like it does in 1.2.
>
> David
>
>
> On 13 Sep 2002, Ian Peters wrote:
> > I don't know how I convinced myself that last patch would help without
> > fixing GNET_SOCKET_IOCHANNEL_NEW in gnet-private.h, but it's rather more
> > difficult with it as a macro to set the encoding in that call. It's
> > rather ugly to set the encoding everywhere it's called, though.
> >
> > Of course, I also forgot people could still be using glib-1.2.
>
>
> --
> __ _ __ David Helder - dhelder umich edu
> ___/ /__ __ __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
> / _ / _ `/ |/ / / _ / Jungle Monkey: <http://www.junglemonkey.net>
> |_,_/|_,_/|___/_/|_,_/ Paper CD Case: <http://www.papercdcase.com>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]