how to read data with g_io_read_channel throwed it through a normal socket




Hi everyone. Im developing a interface for a server program and I have some
problems.Step by step:
- I put the server in listen:
  fd_dealer2server=socket......
  bind....
  listen(fd_dealer2server,MAX_CON)

- I create a channel and I add a watch to the the port binded for everytime
a data goes in
io = g_io_channel_unix_new (fd_dealer2server);
if (!g_io_add_watch (io, G_IO_IN, (GIOFunc) my_func, NULL)){g_error ....}

-Tll here everything its ok.... Later in my_func:
static void my_func (GIOChannel *gio, GIOCondition condition, gpointer
data){
        guint mensaje[1];
        gsize bytes_read;
         if(g_io_channel_read (gio, (gchar *) mensaje , sizeof(mensaje) , &
bytes_read) != G_IO_ERROR_NONE){
                        g_warning("Error\n");
                }

And Finally I have my client binded to the shame port....
        fd=socket
        connect(fd,
        int sms = atoi(argv[2]);
        send( fd, &sms, sizeof(int) ,0);

It catch the event G_IO_IN but g_io_read doesnt works..Always get error. Any
hint???
Regards to every1, Nahuel
-- 
View this message in context: 
http://www.nabble.com/how-to-read-data-with-g_io_read_channel-throwed-it-through-a-normal-socket-tf3568165.html#a9967961
Sent from the Gtk+ - Apps Dev mailing list archive at Nabble.com.




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