diff --git a/src/client.c b/src/client.c index c18de8f..60497b8 100644 --- a/src/client.c +++ b/src/client.c @@ -25,6 +25,11 @@ bool udpClient_open(udpClient_t * restrict client, const char * restrict ipstr, } client->u.si_other.sin_addr.s_addr = inet_addr(address); + if (connect(client->u.s, (struct sockaddr *)&client->u.si_other, sizeof client->u.si_other)) + { + return false; + } + return true; } int udpClient_read(udpClient_t * restrict client, void * restrict buffer, int bufSize) diff --git a/src/udp.c b/src/udp.c index daf50fe..0faa716 100644 --- a/src/udp.c +++ b/src/udp.c @@ -21,7 +21,7 @@ void udp_zero(udp_t * restrict udp) int udp_read(udp_t * restrict udp, void * restrict buffer, int bufSize) { int slen = sizeof(udp->si_other); - return recvfrom(udp->s, buffer, bufSize, 0,(struct sockaddr *)&udp->si_other, &slen); + return recvfrom(udp->s, buffer, bufSize, 0, (struct sockaddr *)&udp->si_other, &slen); } bool udp_write(const udp_t * restrict udp, const void * restrict buffer, int numBytes) {