debug version
Dependents: HTTPClient_WiFi_HelloWorld_src
Fork of SNICInterface by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 34:8c3527b8f44e
- Parent:
- 32:ae95309643aa
- Child:
- 37:f3a2053627c2
diff -r 33f1bc919486 -r 8c3527b8f44e Socket/TCPSocketConnection.cpp --- a/Socket/TCPSocketConnection.cpp Tue Jun 03 08:53:07 2014 +0000 +++ b/Socket/TCPSocketConnection.cpp Mon Jun 09 08:28:07 2014 +0000 @@ -80,16 +80,7 @@ req.socket_id = mSocketID; // set ip addr ( byte order ) - req.remote_addr[0] = ((ip_addr & 0xFF000000) >> 24 ); - req.remote_addr[1] = ((ip_addr & 0xFF0000) >> 16 ); - req.remote_addr[2] = ((ip_addr & 0xFF00) >> 8 ); - req.remote_addr[3] = ( ip_addr & 0xFF); -/* - req.remote_addr[0] = 0xD8; - req.remote_addr[1] = 0x34; - req.remote_addr[2] = 0xE9; - req.remote_addr[3] = 0x78; -*/ + C_SNIC_UartMsgUtil::convertIntToByteAdday( ip_addr, (char *)req.remote_addr ); req.remote_port[0] = ( (port & 0xFF00) >> 8 ); req.remote_port[1] = (port & 0xFF); req.recv_bufsize[0] = ( (SNIC_UART_RECVBUF_SIZE & 0xFF00) >> 8 ); @@ -145,7 +136,6 @@ return con_info_p->is_connected; } -unsigned char gTCP_SEND_BUF[2048]; int TCPSocketConnection::send(char* data_p, int length) { C_SNIC_Core *snic_core_p = C_SNIC_Core::getInstance(); @@ -168,14 +158,15 @@ req.payload_len[0]= ( (length & 0xFF00) >> 8 ); req.payload_len[1]= (length & 0xFF); - int req_size = sizeof(C_SNIC_Core::tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T); - memcpy( gTCP_SEND_BUF, &req, req_size ); - memcpy( &gTCP_SEND_BUF[req_size], data_p, length ); + int req_size = sizeof(C_SNIC_Core::tagSNIC_TCP_SEND_FROM_SOCKET_REQ_T); + char *send_buf_p = getSocketSendBuf(); + memcpy( send_buf_p, &req, req_size ); + memcpy( &send_buf_p[req_size], data_p, length ); unsigned char *command_array = snic_core_p->getCommandBuf(); unsigned int command_len; // Preparation of command - command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, gTCP_SEND_BUF + command_len = snic_core_p->preparationSendCommand( UART_CMD_ID_SNIC, req.cmd_sid, (unsigned char *)send_buf_p , req_size + length, payload_buf->buf, command_array ); // Send uart command request