Stefan Paege wrote:
> Hi,
> 
> I have problems with the task above.
> 
> Delphi 2007, ICS 5.25
> 
> TwSocket used with UDP protocol to send data
> 
> At runtime I use this code to switch to another Addr/Port:
> 
> MySocket.Close;
> repeat
>   Sleep(10);
> until MySocket.State = wsClosed;
> 
> MySocket.Addr := NewAddr;
> MySocket.Port := NewPort;
> 
> MySocket.Connect; // All good until here
> 
> Problem:
> MySocketOnSessionConnected is only triggered if Addr and Port have
> really changed. It is not triggered if the user leaves the values as
> before (I know I can handle that).
> In both cases trying to send data results in an "Socket is not
> connected" exception.
> 
> What's wrong here?

It is because you do not assign all required properties before
the call to connect. After Close the component is assigned default
values including for example Type := SOCK_STREAM. See procedure 
TCustomWSocket.AssignDefaultValue in WSocket.pas.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



> 
> --
> 
> 
> elektronik-labor CARLS GmbH & Co. KG
> 
>   Stefan Paege
> 
> Fon: +49 5973 9497-23
> Fax: +49 5973 9497-19
> 
> ----
> 
> elektronik-labor CARLS GmbH & Co. KG
> Kommanditgesellschaft:
> Sitz Neuenkirchen, Registergericht Steinfurt HRA 3310
> 
> Persönlich haftende Gesellschafterin:
> elektronik-labor CARLS, Beteiligungsgesellschaft mbH,
> Sitz Neuenkirchen, Registergericht Steinfurt HRB 4175
> 
> Geschäftsführer:
> Irmgard Carls, Joachim Schulte
-- 
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