From 77dde8bcb9150af87f8fbe094857fa24dedc6c6c Mon Sep 17 00:00:00 2001 From: Johannes Lorenz Date: Sun, 3 Dec 2023 16:13:52 +0100 Subject: [PATCH] printfs --- src/test_bidirectional_tcp.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/test_bidirectional_tcp.c b/src/test_bidirectional_tcp.c index da0ed10..25c26f1 100644 --- a/src/test_bidirectional_tcp.c +++ b/src/test_bidirectional_tcp.c @@ -21,17 +21,17 @@ int generic_handler(const char *path, const char *types, lo_arg ** argv, lo_address a = lo_message_get_source(data); int prot = lo_address_get_protocol(a); - printf("%p.%s, from %s:%s:%s\n", s, path, + fprintf(stderr, "%p.%s, from %s:%s:%s\n", s, path, (prot==LO_UDP) ? "UDP" : (prot==LO_TCP) ? "TCP" : (prot==LO_UNIX) ? "UNIX" : "?", lo_address_get_hostname(a), lo_address_get_port(a)); - printf("%p.address fd: %d\n", s, ((int*)a)[1]); + fprintf(stderr, "%p.address fd: %d\n", s, ((int*)a)[1]); lo_send_from(a, s, LO_TT_IMMEDIATE, "/reply", 0); - printf("%p.reply sent\n", s); + fprintf(stderr, "%p.reply sent\n", s); return 0; } @@ -42,12 +42,12 @@ unsigned __attribute__((stdcall)) sendthread(void *arg) void *sendthread(void *arg) #endif { - printf("Start of sendthread\n"); + fprintf(stderr, "Start of sendthread\n"); lo_server s = lo_server_new_with_proto("7772", LO_TCP, 0); if (!s) { printf("no server2\n"); exit(1); } - printf("%p.sending thread\n", s); + fprintf(stderr, "%p.sending thread\n", s); lo_server_add_method(s, 0, 0, generic_handler, s); @@ -55,15 +55,15 @@ void *sendthread(void *arg) lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", 0); - printf("%p.message sent\n", s); - printf("%p.sending thread waiting\n", s); + fprintf(stderr, "%p.message sent\n", s); + fprintf(stderr, "%p.sending thread waiting\n", s); lo_server_recv(s); - printf("%p.sending thread received\n", s); + fprintf(stderr, "%p.sending thread received\n", s); - printf("%p.freeing address\n", s); + fprintf(stderr, "%p.freeing address\n", s); lo_address_free(a); - printf("%p.freeing\n", s); + fprintf(stderr, "%p.freeing\n", s); lo_server_free(s); return 0; @@ -77,12 +77,12 @@ int main() lo_server s = lo_server_new_with_proto("7771", LO_TCP, 0); if (!s) { printf("no server\n"); exit(1); } - printf("Server started\n"); + fprintf(stderr, "Server started\n"); /* add method that will match any path and args */ lo_server_add_method(s, 0, 0, generic_handler, s); - printf("%p.server fd: %d\n", s, lo_server_get_socket_fd(s)); + fprintf(stderr, "%p.server fd: %d\n", s, lo_server_get_socket_fd(s)); #ifdef HAVE_WIN32_THREADS HANDLE thr = (HANDLE)_beginthreadex(NULL, 0, &sendthread, s, 0, NULL); @@ -91,13 +91,13 @@ int main() pthread_create(&thr, 0, sendthread, s); #endif - printf("%p.receiving1..\n", s); + fprintf(stderr, "%p.receiving1..\n", s); lo_server_recv(s); - printf("%p.done receiving1\n", s); + fprintf(stderr, "%p.done receiving1\n", s); - printf("%p.receiving2..\n", s); + fprintf(stderr, "%p.receiving2..\n", s); lo_server_recv(s); - printf("%p.done receiving2\n", s); + fprintf(stderr, "%p.done receiving2\n", s); #ifdef HAVE_WIN32_THREADS WaitForSingleObject(thr, INFINITE); @@ -106,11 +106,11 @@ int main() pthread_join(thr, 0); #endif - printf("%p.freeing\n", s); + fprintf(stderr, "%p.freeing\n", s); lo_server_free(s); /* If it gets here without hanging we are good. */ - printf("TEST SUCCESSFUL\n"); + fprintf(stderr, "TEST SUCCESSFUL\n"); return 0; }