cannam@89: /* cannam@89: * Copyright (C) 2004 Steve Harris, Uwe Koloska cannam@89: * cannam@89: * This program is free software; you can redistribute it and/or modify cannam@89: * it under the terms of the GNU Lesser General Public License as cannam@89: * published by the Free Software Foundation; either version 2.1 of the cannam@89: * License, or (at your option) any later version. cannam@89: * cannam@89: * This program is distributed in the hope that it will be useful, cannam@89: * but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@89: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@89: * GNU Lesser General Public License for more details. cannam@89: * cannam@89: * $Id$ cannam@89: */ cannam@89: cannam@89: #include cannam@89: #include cannam@89: #include cannam@89: cannam@89: #include "lo/lo.h" cannam@89: cannam@89: const char testdata[5] = "ABCDE"; cannam@89: cannam@89: int main(int argc, char *argv[]) cannam@89: { cannam@89: /* build a blob object from some data */ cannam@89: lo_blob btest = lo_blob_new(sizeof(testdata), testdata); cannam@89: cannam@89: /* an address to send messages to. sometimes it is better to let the server cannam@89: * pick a port number for you by passing NULL as the last argument */ cannam@89: // lo_address t = lo_address_new_from_url( "osc.unix://localhost/tmp/mysocket" ); cannam@89: lo_address t = lo_address_new(NULL, "7770"); cannam@89: cannam@89: if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'q') { cannam@89: /* send a message with no arguments to the path /quit */ cannam@89: if (lo_send(t, "/quit", NULL) == -1) { cannam@89: printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); cannam@89: } cannam@89: } else { cannam@89: /* send a message to /foo/bar with two float arguments, report any cannam@89: * errors */ cannam@89: if (lo_send(t, "/foo/bar", "ff", 0.12345678f, 23.0f) == -1) { cannam@89: printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); cannam@89: } cannam@89: cannam@89: /* send a message to /a/b/c/d with a mixtrure of float and string cannam@89: * arguments */ cannam@89: lo_send(t, "/a/b/c/d", "sfsff", "one", 0.12345678f, "three", cannam@89: -0.00000023001f, 1.0); cannam@89: cannam@89: /* send a 'blob' object to /a/b/c/d */ cannam@89: lo_send(t, "/a/b/c/d", "b", btest); cannam@89: cannam@89: /* send a jamin scene change instruction with a 32bit integer argument */ cannam@89: lo_send(t, "/jamin/scene", "i", 2); cannam@89: } cannam@89: cannam@89: return 0; cannam@89: } cannam@89: cannam@89: /* vi:set ts=8 sts=4 sw=4: */