Re: [twsocket] Changing a socket's Addr and Port at runtime

2008-12-09 Thread Francois PIETTE
> MySocket.Close; > repeat > Sleep(10); > until MySocket.State = wsClosed; Beside the good answer given by Arno, I would say that the above code is really not recommanded for the following reason: You should not wait on the State property but instead use the events. And if you really, really wan

Re: [twsocket] Changing a socket's Addr and Port at runtime

2008-12-09 Thread Stefan Paege
Arno Garrels schrieb: > 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. OK Arno, setting Prot

Re: [twsocket] Changing a socket's Addr and Port at runtime

2008-12-09 Thread Arno Garrels
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; > > MySoc

[twsocket] Changing a socket's Addr and Port at runtime

2008-12-09 Thread Stefan Paege
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; MySo