Re: GIOChannel



On Monday 19 January 2004 22:22, Harring Figueiredo wrote:

 Folks, I am creating a GIOChannel, and I get the error:
[Invalid UTF-8] üôÿ¿

 How can I set up so that it does not fail. (Thanks -- se code below)
NOTE: I don't even have a chance to write to it.

(snip)

    /* create the channel */
    server = g_io_channel_unix_new(socketfd);
    if(server == NULL){
            g_print("Count not create server..");
            return FALSE;
    }

     g_io_channel_set_encoding (c, NULL, NULL); 
     g_io_channel_set_buffered (c, FALSE); 

silly question maybe, but why 'c' and not

      g_io_channel_set_encoding (server, NULL, NULL); 
      g_io_channel_set_buffered (server, FALSE); 

the _set_encoding(server,NULL,NULL) is what should do the trick. It should 
also be called right after you created the GIOChannel (more or less).



Btw, in case you haven't yet, you might also want to have a look at the GNet 
library's GServer and GConn interfaces, which might just do exactly what you 
want without all the GIOChannel hassle:

  http://www.gnetlibrary.org/docs/gnet-server.html
  http://www.gnetlibrary.org/docs/gnet-conn.html

A similar library is the fairly new libgnetwork, which seems to require 
glib-2.3.x or newer though:

   http://ftp.gnome.org/pub/GNOME/sources/libgnetwork/0.0/libgnetwork-0.0.5.tar.gz

Cheers
-Tim





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