Skip to content

Commit 13ea8ec

Browse files
mjlitkesandeepmistry
authored andcommitted
Fix WiFiUDP::endPacket() return code, rev2 (#249)
1 parent f474f94 commit 13ea8ec

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/WiFiUdp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int WiFiUDP::endPacket()
137137

138138
int result = WiFiSocket.sendto(_socket, (void *)_sndBuffer, _sndSize, 0, (struct sockaddr *)&addr, sizeof(addr));
139139

140-
return (result <= 0) ? 0 : 1;
140+
return (result < 0) ? 0 : 1;
141141
}
142142

143143
size_t WiFiUDP::write(uint8_t byte)

src/utility/WiFiSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ sint16 WiFiSocketClass::sendto(SOCKET sock, void *pvSendBuffer, uint16 u16SendLe
319319
m2m_wifi_handle_events(NULL);
320320

321321
if (_info[sock].state != SOCKET_STATE_BOUND) {
322-
return 0;
322+
return -1;
323323
}
324324

325325
return ::sendto(sock, pvSendBuffer, u16SendLength, flags, pstrDestAddr, u8AddrLen);

0 commit comments

Comments
 (0)