Skip to content

Commit

Permalink
Minor improvement, add connect to client
Browse files Browse the repository at this point in the history
  • Loading branch information
makuke1234 committed Apr 28, 2022
1 parent b660ec8 commit 95f9824
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 95f9824

Please sign in to comment.