Skip to content

Instantly share code, notes, and snippets.

@briansorahan
Created August 3, 2014 02:57
Show Gist options
  • Save briansorahan/33c8c545b706bd381de4 to your computer and use it in GitHub Desktop.
Save briansorahan/33c8c545b706bd381de4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <lo/lo.h>
#include <lo/lo_types.h>
void
lo_err(int num,
const char *msg,
const char *where)
{
fprintf(stderr, "lo_err %d [%s] %s\n", num, where, msg);
}
int
trace_handler(const char *path,
const char *types,
lo_arg **argv,
int argc,
lo_message msg,
void *data)
{
printf("trace_handler %s,%s\n", path, types);
}
int
path_handler(const char *path,
const char *types,
lo_arg **argv,
int argc,
lo_message msg,
void *data)
{
printf("path_handler %s,%s\n", path, types);
}
int main()
{
const char *port = "41068";
lo_server server = lo_server_new(port, lo_err);
lo_server_add_method(server, NULL, NULL, trace_handler, NULL);
lo_server_add_method(server, "/lightning/kits/default/samples/*",
"ff", path_handler, NULL);
while (1) {
lo_server_recv(server);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment