SNIC UART Interface library for Murata Type-YD module
Dependents: WebSocketServerTest
Fork of SNICInterface_mod by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 44:c50e7332afcc
- Parent:
- 43:d80bbb12ffe6
diff -r d80bbb12ffe6 -r c50e7332afcc Socket/TCPSocketConnection.cpp --- a/Socket/TCPSocketConnection.cpp Fri Nov 14 00:52:31 2014 +0000 +++ b/Socket/TCPSocketConnection.cpp Fri Nov 21 03:50:48 2014 +0000 @@ -191,7 +191,7 @@ // SNIC_SEND_FROM_SOCKET_REQ FUNC_OUT(); - return 0; + return length; } int TCPSocketConnection::send_all(char *data_p, int length) @@ -229,9 +229,17 @@ return -1; } con_info_p->is_receive_complete = true; - while( con_info_p->is_received == false ) + if( con_info_p->is_received == false ) { + // Try receive Thread::yield(); + + if( con_info_p->is_received == false ) + { + // No data received. + FUNC_OUT(); + return 0; + } } // Get packet data from buffer for receive. for (i = 0; i < length; i ++) @@ -253,6 +261,11 @@ return i; } +int TCPSocketConnection::receive_all(char* data_p, int length) +{ + return receive( data_p, length ); +} + void TCPSocketConnection::setAcceptSocket( int socket_id ) { FUNC_IN();