More fixes

This commit is contained in:
Stephen Seo 2019-03-04 18:17:28 +09:00
parent aa094224bc
commit 9134079b8d
2 changed files with 8 additions and 1 deletions

View file

@ -46,7 +46,7 @@ UDPC_Context* UDPC_init(uint16_t listenPort, int isClient)
context->socketInfo.sin_family = AF_INET; context->socketInfo.sin_family = AF_INET;
// TODO specify what addr to listen on // TODO specify what addr to listen on
context->socketInfo.sin_addr.s_addr = INADDR_ANY; context->socketInfo.sin_addr.s_addr = INADDR_ANY;
context->socketInfo.sin_port = listenPort; context->socketInfo.sin_port = htons(listenPort);
if(bind( if(bind(
context->socketHandle, context->socketHandle,
(const struct sockaddr*) &context->socketInfo, (const struct sockaddr*) &context->socketInfo,

View file

@ -63,6 +63,13 @@ int main(int argc, char** argv)
} }
UDPC_Context *ctx = UDPC_init(listenPort, isClient); 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) if(UDPC_get_error(ctx) == UDPC_SUCCESS)
{ {
UDPC_set_logging_type(ctx, 4); UDPC_set_logging_type(ctx, 4);