void vortex_listener_new gchar *  host,
gchar *  port,
VortexListenerReady  on_ready,
gpointer  user_data
 

Creates a new Vortex Listener accepting incoming connections on the given host port configuration.

Creates a new vortex listener on the given host and port.

If user pass in an on_ready callback, it will be notified on it, in a separated thread, once the process have finished. Check documentation for the VortexListenerReady handler which is the async definition for on_ready handler.

On that notification will also be passed the host and port actually allocated. Think about using as host 0.0.0.0 and port 0.

These values will cause to vortex_listener_new to allocate the system configured hostname and a randomly free port. See this section for more info about on_ready.

Host and port value provided to this function to be unrefered just from returning from this function. The function performs a local copy that is unrefered at the appropriate moment.

Here is an little example to start a vortex listener server:

 // On this example you'll find:
 //   - 3 handlers: frame_received, start_channel and
 //                 close_channel (which handle the event
 //                 they represent).
 //   - An entry point (main function) which creates a
 //     a simple listener server, using previous three
 //     basic handlers.

 // a frame handler
 void frame_received (VortexChannel    * channel,
                      VortexConnection * connection,
                      VortexFrame      * frame,
                      gpointer           user_data)
 {
        // Received a frame from the remote side.
        // process it and reply to it if it is a MSG.
        return;
 }

 gboolean start_channel (gint               channel_num, 
                        VortexConnection * connection, 
                        gpointer           user_data)
 {
        g_print ("Received an start message=%d!!\n",
                 channel_num);
        // if the async notifier returns TRUE, the channel
        // is implicitly created, if FALSE is returned the
        // channel creation is denied and a reply error
        // is sent.
        return TRUE;
 }

 gboolean close_channel (gint               channel_num, 
                         VortexConnection * connection, 
                         gpointer           user_data)
 {
        g_print ("Got a close message notification!!\n");

        // if TRUE is returned, the channel is
        // accepted to be closed. Otherwise the channel
        // will not be closed and an error reply will be
        // sent to the remote peer.
        return TRUE;
 }
 int main (int argc, char * argv) {
      // enable log to see whats going on 
      vortex_log_enable (TRUE);
      
      // init vortex library (and check its result!)
      if (! vortex_init ()) {
           g_print ("Unable to initialize vortex library\n");
           exit -1;
      }
 
      // register a profile
      vortex_profiles_register ("http://vortex.aspl.es/profiles/example", 
                                start_channel, NULL,
                                close_channel, NULL,
                                frame_received, NULL);
 
      // now create a vortex server
      vortex_listener_new ("0.0.0.0", "3000", NULL, NULL);
      
      // wait for listener to finish (maybe due to vortex_exit call)
      vortex_listener_wait ();
  
      // end vortex internal subsystem (if no one have done it yet!)
      vortex_exit ();
 
      // that's all to start BEEPing!
      return 0;     
 }  

Parameters:
host the host to listen to.
port the port to listen to.
on_ready a optional notify callback to get when vortex listener is ready to perform replies.
user_data a user defined pointer to be passed in to on_ready handler.