X Tutup
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/WebsocketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,15 @@ void WebsocketHandler::send(uint8_t* data, uint16_t length, uint8_t sendType) {
frame.len = 126;
_con->writeBuffer((uint8_t *)&frame, sizeof(frame));
uint16_t net_len = htons(length);
_con->writeBuffer((uint8_t *) net_len, sizeof(uint16_t)); // Convert to network byte order from host byte order
//replaced by George2209 on 2019-11-11 (avoid forced/implicit conversion):
//_con->writeBuffer((uint8_t *) net_len, sizeof(uint16_t)); // Convert to network byte order from host byte order
//start of replacement of the upper line:
{
uint8_t tmp_buffer[sizeof(uint16_t)];
memcpy(tmp_buffer,&net_len,sizeof(uint16_t));
_con->writeBuffer(tmp_buffer, sizeof(uint16_t)); // Convert to network byte order from host byte order
}
//end of replacement of George2209
}
_con->writeBuffer(data, length);
HTTPS_LOGD("<< Websocket.send()");
Expand Down
X Tutup