36void error(
int num,
const char *m,
const char *path);
38int echo_handler(
const char *path,
const char *types,
lo_arg ** argv,
39 int argc,
void *data,
void *user_data);
41int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
42 int argc,
void *data,
void *user_data);
49int main(
int argc,
char *argv[])
51 const char *port =
"7770";
54 if (argc > 1 && argv[1][0]==
'1') {
62 printf(
"Could not create server thread.\n");
78 printf(
"Listening on TCP port %s\n", port);
84 printf(
"Error creating destination address.\n");
90 printf(
"Error sending initial message.\n");
108void error(
int num,
const char *msg,
const char *path)
110 printf(
"liblo server error %d in path %s: %s\n", num, path, msg);
116int echo_handler(
const char *path,
const char *types,
lo_arg ** argv,
117 int argc,
void *data,
void *user_data)
134 printf(
"path: <%s>\n", path);
135 for (i = 0; i < argc; i++) {
136 printf(
"arg %d '%c' ", i, types[i]);
142 printf(
"Couldn't get message source, quitting.\n");
149 printf(
"Error sending back message, socket may have closed.\n");
151 printf(
"Sent message back to %s:%s.\n", host, port);
154 printf(
"Got enough messages, quitting.\n");
161int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
162 int argc,
void *data,
void *user_data)
165 printf(
"quitting\n\n");
lo_type
An enumeration of the OSC types liblo can send and receive.
void lo_address_free(lo_address t)
Free the memory used by the lo_address object.
int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *type,...)
Send a OSC formatted message to the address specified, from the same socket as the specified server.
lo_address lo_address_new_with_proto(int proto, const char *host, const char *port)
Declare an OSC destination, given IP address and port number, specifying protocol.
#define LO_TT_IMMEDIATE
A timetag constant representing "now".
const char * lo_address_get_hostname(lo_address a)
Return the hostname of a lo_address object.
lo_address lo_message_get_source(lo_message m)
Returns the source (lo_address) of an incoming message.
int lo_send_message_from(lo_address targ, lo_server serv, const char *path, lo_message msg)
Send a lo_message object to target targ from address of serv.
const char * lo_address_get_port(lo_address a)
Return the port/service name of a lo_address object.
void lo_arg_pp(lo_type type, void *data)
Pretty-print a set of typed arguments.
int lo_server_thread_start(lo_server_thread st)
Start the server thread.
lo_server_thread lo_server_thread_new_with_proto(const char *port, int proto, lo_err_handler err_h)
Create a new server thread to handle incoming OSC messages, specifying protocol.
lo_server lo_server_thread_get_server(lo_server_thread st)
Return the lo_server for a lo_server_thread.
void lo_server_thread_free(lo_server_thread st)
Free memory taken by a server thread.
lo_method lo_server_thread_add_method(lo_server_thread st, const char *path, const char *typespec, lo_method_handler h, const void *user_data)
Add an OSC method to the specifed server thread.
void * lo_server_thread
An object representing a thread containing an OSC server.
void * lo_server
An object representing an instance of an OSC server.
void * lo_address
A reference to an OSC service.
void * lo_message
A low-level object used to represent messages passed over OSC.
Union used to read values from incoming messages.