chipKIT® Development Platform

Inspired by Arduino™

how to reset tcp server in Chipkit wf32 DNETck?

Created Thu, 27 Nov 2014 02:03:50 +0000 by dharanikumarsrvn


dharanikumarsrvn

Thu, 27 Nov 2014 02:03:50 +0000

Hi, My chipkit wf32 board act as a tcp server and android smartphone act as tcp client. In wf32 i used DNETck library and in android i am using Socket package. my server will send data at regular intervals. Client will not send any data to server, it just receives. In server, i am calling isconnected(&DNETck::status) regularly to check the status of the connection. When i close the app, isconnected() fails, if i check isstatusanerror(&DNETck::status), it returns true. In that scenario what should i do, 1. close just the tcpclient and start listening, 2. close tcpclient and tcpserver and starts from binding the server to port, 3. close tcpclient, close tcpserver and start from DNetck::begin()? Please clarify me.


KeithV

Fri, 28 Nov 2014 18:10:00 +0000

Just close the socket and start listening. The server object is independent of the client objects, which should have been called sockets and is in the new deIP stack. The server sits and listens, the clients are either waiting sockets that the server can use, or connected sockets you can communicate on. Once a socket is disconnected, close it to clean it up, and then you can hand it back tot he server to listen on. As the documentation says, once you accept the socket (client) the sever releases all control of that client object.