Skip to content

Commit

Permalink
Update WiFiUdp.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mrengineer7777 committed Feb 15, 2023
1 parent 23f653a commit 6a15908
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/WiFi/src/WiFiUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ int WiFiUDP::parsePacket(){
return 0;
struct sockaddr_in si_other;
int slen = sizeof(si_other) , len;
char * buf = new char[1460];
if(!buf){
char *buf = (char *)malloc(1460);
if(!buf) {
return 0;
}
if ((len = recvfrom(udp_server, buf, 1460, MSG_DONTWAIT, (struct sockaddr *) &si_other, (socklen_t *)&slen)) == -1){
delete[] buf;
free(buf);
if(errno == EWOULDBLOCK){
return 0;
}
Expand All @@ -225,7 +225,7 @@ int WiFiUDP::parsePacket(){
rx_buffer = new cbuf(len);
rx_buffer->write(buf, len);
}
delete[] buf;
free(buf);
return len;
}

Expand Down

0 comments on commit 6a15908

Please sign in to comment.