I have an application that connects to a list of selected devices. It opens a 
connection, and once open, sends a command string to that device. This is 
intended to replace a similar application that could do this for an entire list 
of devices.

This new version has presented me with a problem. I can successfully connect to 
the first device in the list, and send the command in the OnConnected event. 
Through reading comments in the source, I understand that the problems 
originated with the way I'm handling this. 

After the first connect, I try to do the next, which, I can see, is the 
problem. I cannot change the address because that original connection is still 
open. I have tried various methods without success. I would like to have any 
sort of suggestion or pointer as to how I can properly wait for the connection 
to be closed before changing the address and moving to the next selected device.

Here is a section of the relevant code, where I retrieve the list of selected 
devices, then try to walk through them:

  with dmM5Agent.spGetTaggedStores do
      Parameters.ParamByName('@UserID').Value := GetUserFromWindows;
      StoreCounter := RecordCount;

      for Counter := 0 to StoreCounter-1 do

          WSocket1.Addr := FieldByName('StoreNumber').AsString;
          WSocket1.Port := M5Port;

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