My fork
Dependencies: WncControllerK64F
Fork of WNCInterface by
Diff: Socket/WncTCPSocketConnection.cpp
- Revision:
- 29:b278b745fb4f
- Parent:
- 28:dceb8da78e6d
--- a/Socket/WncTCPSocketConnection.cpp Fri Mar 24 22:02:33 2017 +0000 +++ b/Socket/WncTCPSocketConnection.cpp Fri Mar 24 22:26:23 2017 +0000 @@ -25,16 +25,12 @@ #define READ_EVERYMS 500 //number of milliseconds between WNC socket reads -TCPSocketConnection::TCPSocketConnection() : - _is_blocking(0), - _btimeout(0){ -} // // blocking is used to make the WNC keep checking for incoming data for a // period of time. // -void TCPSocketConnection::set_blocking (bool blocking, unsigned int timeout) { +void WncTCPSocketConnection::set_blocking (bool blocking, unsigned int timeout) { _is_blocking = blocking; // true if we want to wait for request _btimeout = timeout; // user specs msec @@ -46,17 +42,17 @@ } -int TCPSocketConnection::connect(const char* host, const int port) { +int WncTCPSocketConnection::connect(const char* host, const int port) { WncSocket::connect((char*)host, SOCK_STREAM, port); _is_blocking = false; // start out not blocking, user will set it if desired return ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 0:-1; } -bool TCPSocketConnection::is_connected(void) { +bool WncTCPSocketConnection::is_connected(void) { return ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 1:0; } -int TCPSocketConnection::send(char* data, int length) { +int WncTCPSocketConnection::send(char* data, int length) { int ret = -1; WncController_fk::WncController::WncState_e s = WNCInterface::_pwnc->getWncStatus(); @@ -72,7 +68,7 @@ return ret; } -int TCPSocketConnection::receive(char *readBuf, int length) { +int WncTCPSocketConnection::receive(char *readBuf, int length) { Timer t; size_t done, cnt; int ret=-1; @@ -106,15 +102,15 @@ return ret; } -int TCPSocketConnection::send_all(char* data, int length) { +int WncTCPSocketConnection::send_all(char* data, int length) { return send(data,length); } -int TCPSocketConnection::receive_all(char* data, int length) { +int WncTCPSocketConnection::receive_all(char* data, int length) { return receive(data,length); } -int TCPSocketConnection::close(void) { +int WncTCPSocketConnection::close(void) { WncSocket::disconnect(); M_LOCK; int ret = ( WNCInterface::_pwnc->getWncStatus() == WncController_fk::WncController::WNC_ON )? 0:-1;