gtk - GIO example for opening a server port? -


Can you please tell me that there is an example for using the GIO server socket (I can open a port Can I hear more on socket requests?) I want to use this 'remote-control' in my GTK + application.

I think you should do something like this:

  # MY_PORT 47110 / * Define, the listener's callback, it is called by GTK + when the socket activity is to handle * steady / gabolian cb_listener (GIOChannel * source, geocaching status, gpointer data {switch (status) { Case G_IO_IN: / * The data to be read. * / Break; default: / * An error has occurred, or the socket is closed * / return incorrect; / * To the EO, it can be harsh. * Returns TRUE; / * It tells GIO that everything is fine. * /}  

Then somewhere (in a function, Maybe main () ):

  GSKT listener * listener; listener = g_socket_listener_new (); g_socket_listener_add_inet_port (listener, MY_PORT, NULL, NULL); G_io_add_watch (G_IO_CHANNEL (listener) ), G_IO_IN | GIORER | GIIOHUP, CB-LISTER, FALL);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -