> nLen := WSocket1.Receive(@FCmd2[FPos], SizeOf(TCtlCmd2) - FPos); Why do you only want to receive a little part of what you are sending? You should fill a much large buffer and then parse that for your record.
Beware TCP packets can be split and combined, and are not necessarily the same as when transmitted, so your header record may not be arrive in a single Receive call, but will most likely arrive with the stream as well. > ShowMessage(inttostr(TCtlCmd2(FCmd2).cmd)); Never call modal dialogs from ICS events, it breaks the events, possibly causing re-entry to the same events due to the message pump being called and perhaps stalling ICS. For debugging, just put a simple TMemo on the form, like all the sample applications, or write a log file if this is a windows service. If you need to tell someone about received data, send a windows message to trigger another procedure that opens the modal dialog. Angus -- 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