36 void error(
int num,
const char *m,
const char *path);
38 int echo_handler(
const char *path,
const char *types,
lo_arg ** argv,
41 int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
49 int 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");
108 void error(
int num,
const char *msg,
const char *path)
110 printf(
"liblo server error %d in path %s: %s\n", num, path, msg);
116 int echo_handler(
const char *path,
const char *types,
lo_arg ** argv,
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");
161 int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
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".
lo_address lo_message_get_source(lo_message m)
Returns the source (lo_address) of an incoming message.
const char * lo_address_get_port(lo_address a)
Return the port/service name of a lo_address object.
const char * lo_address_get_hostname(lo_address a)
Return the hostname of a lo_address object.
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.
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.
struct lo_server_ * lo_server
An object representing an instance of an OSC server.
struct lo_address_ * lo_address
A reference to an OSC service.
struct lo_message_ * lo_message
A low-level object used to represent messages passed over OSC.
struct lo_server_thread_ * lo_server_thread
An object representing a thread containing an OSC server.
Union used to read values from incoming messages.