[gnet] Call gnet_conn_write in a signal handler



Hi,

I am trying to call gnet_conn_write in a signal
handler:

I see the debug printf and the value of what I try to
print is correct. But I can't recevie anything on the
other end of the socket:

static void 
ob_sig_int (int signum)
{
  printf ("clean up\n");

  char buffer [33];
  sprintf (buffer,"%d", 10);

  printf ("%s\n", buffer);  // it is 10, which is
correct
printf ("%d\n", strlen(buffer)); // it is 2 which is
correct also
  
  gnet_conn_write (conn, buffer, strlen(buffer));

  gnet_conn_delete (conn);
  gtk_main_quit();
  exit (EXIT_FAILURE);
}

So my questions are:
1. Do I need to 'flush' the socket before I call
gnet_conn_delte/gtk_main_quit()?
2. Can I call gnet_conn_write in a signal handler?

Thank you.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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