24 #include <sys/types.h>
34 void error(
int num,
const char *m,
const char *path);
36 int generic_handler(
const char *path,
const char *types,
lo_arg ** argv,
39 int foo_handler(
const char *path,
const char *types,
lo_arg ** argv,
42 int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
45 void read_stdin(
void);
85 retval = select(lo_fd + 1, &rfds, NULL, NULL, NULL);
89 printf(
"select() error\n");
92 }
else if (retval > 0) {
94 if (FD_ISSET(0, &rfds)) {
99 if (FD_ISSET(lo_fd, &rfds)) {
114 (
"non-blocking input from stdin not supported under Windows\n");
124 retval = select(1, &rfds, NULL, NULL, &tv);
128 printf(
"select() error\n");
131 }
else if (retval > 0 && FD_ISSET(0, &rfds)) {
146 void error(
int num,
const char *msg,
const char *path)
148 printf(
"liblo server error %d in path %s: %s\n", num, path, msg);
153 int generic_handler(
const char *path,
const char *types,
lo_arg ** argv,
158 printf(
"path: <%s>\n", path);
159 for (i = 0; i < argc; i++) {
160 printf(
"arg %d '%c' ", i, types[i]);
170 int foo_handler(
const char *path,
const char *types,
lo_arg ** argv,
174 printf(
"%s <- f:%f, i:%d\n\n", path, argv[0]->f, argv[1]->i);
180 int quit_handler(
const char *path,
const char *types,
lo_arg ** argv,
184 printf(
"quiting\n\n");
189 void read_stdin(
void)
195 int len = read(0, buf, 256);
198 fwrite(buf, len, 1, stdout);
lo_type
An enumeration of the OSC types liblo can send and receive.
lo_method lo_server_add_method(lo_server s, const char *path, const char *typespec, lo_method_handler h, const void *user_data)
Add an OSC method to the specifed server.
int lo_server_recv_noblock(lo_server s, int timeout)
Look for an OSC message waiting to be received.
lo_server lo_server_new(const char *port, lo_err_handler err_h)
Create a new server instance.
int lo_server_get_socket_fd(lo_server s)
Return the file descriptor of the server socket.
void lo_arg_pp(lo_type type, void *data)
Pretty-print a set of typed arguments.
struct lo_server_ * lo_server
An object representing an instance of an OSC server.
struct lo_message_ * lo_message
A low-level object used to represent messages passed over OSC.
Union used to read values from incoming messages.