Next: Adding Substance: Inputs and Outputs, Up: The starter-core Library: Building Your Own Ecosystem [Contents]
#include <stdlib.h>
#include <glib.h>
#include <starter/mdns.h>
#include <starter/server.h>
#include <starter/input.h>
#include <starter/output.h>
static GPtrArray *inputs = NULL;
static GPtrArray *outputs = NULL;
static STVersion version = { 0, 1, 0 };
int main(int argc, char *argv[])
{
GMainLoop *gloop = NULL;
STServer *server;
STMDNS *mdns;
GError *error = NULL;
gloop = g_main_loop_new(NULL, FALSE);
// Initializing I/O containers
inputs = g_ptr_array_new_full(0, g_object_unref);
outputs = g_ptr_array_new_full(0, g_object_unref);
// Creating the Server instance
server = st_server_new("ST:MyFirstService", &version,
inputs, outputs);
st_server_start(server, 0, &error);
// Publishing the service via ZeroConf (mDNS)
mdns = st_mdns_new();
st_mdns_publish_service(mdns, st_server_get_name(server),
"_dbus._tcp", st_server_get_port(server));
g_main_loop_run(gloop);
return EXIT_SUCCESS;
}