diff --git a/src/WebsocketHandler.cpp b/src/WebsocketHandler.cpp index 7a2e087..8564cf2 100644 --- a/src/WebsocketHandler.cpp +++ b/src/WebsocketHandler.cpp @@ -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()");