[twsocket] ICS functions blocked when UI is active

2008-06-03 Thread John D Algeo
I have observed that Windows does not pass messages to an application when 
certain User Interface functions are active.  Examples are an open drop-down 
menu or a user dragging a window.  This can cause ICS functions such as this 
Socket Open code to fail:

   { Use while to repeat connects to ensure enough time for reset to end }
tTarget := Time + ((FiResetTime / 1000.0) / 86400.0);
while not FfConnected and (Time  tTarget) do begin
  FiLastError := SocketConnect; { Sets FfConnecting }
  if FiLastError = FX_OK then
  begin
{ FfConnecting is cleared by FWSocketSessionConnected, may happen on
  socket connection timeout }
while FfConnecting do
  Application.ProcessMessages;{ This can be FWSocket.MessagePump; }
  end; {if FiLastError=FX_OK}
end; {while not connected}

With a drop-down menu open, this will run as for long as FiResetTime is set ( 
30 seconds) without connecting.

Is there a way to make Windows continue to pass messages even if a drop-down 
menu or other UI function is active?

Thanks,
John
-- 
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


[twsocket] Lost packets from an Instrument interfaced via TCP/IP

2008-04-16 Thread John D Algeo
I am using ICS in a 32 bit replacement of a 16 bit application that operates a 
laboratory instrument that uses TCP/IP.  It is working well except for an 
occaisional failure to catch all of the packets sent after a data collection.  
The instrument sends a header packet followed by 49 data packets.  The 
instrument does not wait for the host computer to acknowledge each packet.  
Using Ethereal, I see two packets of 1408 data bytes each from the instrument 
followed by an ACK from the host computer, then a single 1408 byte packet from 
the instrument and an ACK from the host.  This pattern repeats until all 49 
packets have been sent.

Most of the time, this works.  Sometimes, especially if the host is busy, the 
host ends up one packet short of the complete message.

I call Receive() on every OnDataAvailable and store the data in a preallocated 
buffer, incrementing the pointer passed to Receive() by the number of bytes 
transferred so that no copying is needed after Receive to assemble the packets.

There are about 20 - 25 ms between the two packets in a pair.

Is the server (instrument) behaving acceptably?  Is there anything I can do to 
better accomodate it?

Thanks,
John
-- 
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