diff --git a/src/UDPConnection.c b/src/UDPConnection.c index 4cde3ab..827a30e 100644 --- a/src/UDPConnection.c +++ b/src/UDPConnection.c @@ -46,7 +46,7 @@ UDPC_Context* UDPC_init(uint16_t listenPort, int isClient) context->socketInfo.sin_family = AF_INET; // TODO specify what addr to listen on context->socketInfo.sin_addr.s_addr = INADDR_ANY; - context->socketInfo.sin_port = listenPort; + context->socketInfo.sin_port = htons(listenPort); if(bind( context->socketHandle, (const struct sockaddr*) &context->socketInfo, diff --git a/src/test/UDPC_NetworkTest.c b/src/test/UDPC_NetworkTest.c index d3bc297..960d0fc 100644 --- a/src/test/UDPC_NetworkTest.c +++ b/src/test/UDPC_NetworkTest.c @@ -63,6 +63,13 @@ int main(int argc, char** argv) } UDPC_Context *ctx = UDPC_init(listenPort, isClient); + + printf("isClient: %s, targetAddr: %s, targetPort: %u, listenPort: %u\n", + isClient == 0 ? "false" : "true", + UDPC_INTERNAL_atostr(ctx, targetAddress), + targetPort, + listenPort); + if(UDPC_get_error(ctx) == UDPC_SUCCESS) { UDPC_set_logging_type(ctx, 4);