11111
Fork of WIZnetInterface by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 31:fc14e4330419
- Parent:
- 30:6feeaebad180
--- a/Socket/TCPSocketConnection.cpp Fri Nov 04 02:28:28 2016 +0000 +++ b/Socket/TCPSocketConnection.cpp Fri Nov 04 07:38:07 2016 +0000 @@ -32,34 +32,41 @@ int TCPSocketConnection::connect(const char* host, const int port) { Serial pc5(PA_13,PA_14); - pc5.baud(115200); + pc5.printf("in connect\r\n"); if (_sock_fd < 0) { + pc5.printf("_sock_fd\r\n"); _sock_fd = eth->new_socket(); + pc5.printf("_sock_fd2\r\n"); if (_sock_fd < 0) { pc5.printf("in connect 1 return -1\r\n"); return -1; } } + pc5.printf("in2 connect\r\n"); + if (set_address(host, port) != 0) { pc5.printf("in connect 2 return -1\r\n"); return -1; } + + pc5.printf("in3 connect\r\n"); if (!eth->connect(_sock_fd, get_address(), port)) {//should jion the timeout pc5.printf("in connect 3 return -1\r\n"); return -1; } + pc5.printf("in4 connect\r\n"); set_blocking(false); // add code refer from EthernetInterface. _is_connected = true; - + pc5.printf("_is_connected=true\r\n"); return 0; } bool TCPSocketConnection::is_connected(void) { Serial pc2(PA_13,PA_14); - pc2.baud(115200); + pc2.printf("in is_connected()\r\n"); // force update recent state. _is_connected = eth->is_connected(_sock_fd);