Re: [twsocket] How can I know that my client is connected?

2006-09-28 Thread David Bridges

Hi Wilfried,

Thanks that works great.   I had tried OnSessionConnected but didn't know 
how to interpret the error parameter, as long as I test for zero it works 
great.

David


- Original Message - 
From: "Wilfried Mestdagh" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Thursday, September 28, 2006 6:40 AM
Subject: Re: [twsocket] How can I know that my client is connected?


> 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
> 

-- 
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


Re: [twsocket] How can I know that my client is connected?

2006-09-28 Thread Wilfried Mestdagh
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