Hello David,

> My question is how can I have a scheme were the clients and server
> can connect when conditions are right for them to do so and have a
> definite knowledge in the client that it is connected rather than a
> connected state that is toggling?

OnChangeState is more for logging or display. Use OnSessionConnected to
see if it connected or not. If not connected then OnSessionConnected is
fired with a Winsock error.

Some other things:

>   wclientSocket->Shutdown(2);
>   wclientSocket->Close();

Since this handler is called from OnSessionClosed, you dont have to
shutdown or close it again. So you can comment out these lines.

> When the sever starts it opens a listening socket...
> wserverSocket->>Close();
> ...
> wserverSocket->>Listen();

Same comment, if the server start it is closed. And also if it is not
then this code will give you errors because all methods are non
blocking. So you can leave the close call out of here also.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to