Hello Andrea,

You should check in every event if there is a Winsock error. When nobody
is listening then OnSessionConnected is fired with winsock error 10061.
Then you know there is no connection. That is how winsock works.

Use the OnChangeState only for displaying options if you need it.

If you write a client the OnSessionConnected, OnSessionClosed (with
Winsock error checking) is importand.

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

Thursday, November 19, 2009, 15:20, Andrea Mennini wrote:

> Hi,

> I have a problem with connection successful / unsuccessful handling.

> TWsocket is version 5.5.

> I use it to send some commands to a remote, without any ACK, I.e. I open
> the connection, when the connection is on I write and so on.

> Everything works when the remote exists.

> If I try to connect to a non existent IP, that I'm sure it does not 
> exist, what I have is that the program waits and then after a while an
> OnChange event is fired and the state I have in wsConnected. Then, an 
> OnConnect event is fired.

> This is quite strange: why does it say "connected" while nobody connects
> to it?

> Is there any way for instance in the OnConnect to undestand whether it
> is really connected or not?

> How can I correctly handle this situation?

> Thanks

> Ciao

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

Reply via email to