This is a new, free component for ICS V6, that dramatically simplifies the use of TWSocket and TWSocketServer, avoiding needing to understand many internals of ICS, in the same way as the FTP and HTTP components do for those protocols.
I've found that many of my applications that need to send simple IP streams between themselves and other applications, and are getting cluttered up with repeated event handling code (connected, disconnected, dataavailable, etc). TMagIpLog hides all this events, handles the differences between UDP/TCP and client/server protocols, and handles all errors, retries, etc. Download from: http://www.magsys.co.uk/delphi/magics.asp TMagIpLog is designed for IP stream logging, using TCP Client, TCP Server, UDP Client or UDP Server protocols, sending simple text lines across a network so they may be displayed or written to disk remotely. The component allows two way communication with TCP and UDP, so may also be used for simple protocols such as communication between two applications. The component supports multiple client sockets so may be used to send data to two or more different remote servers at the same time. For TCP and UDP clients, the component will optionally ping the remote computer first before opening an IP connection to allow faster failure retries and some confirmation that UDP may work. TCP client provides repeated connection retry attempts, including re-establishing a lost connection. UDP client will optionally keep pinging the remote during a connection to ensure it's still there. UDP server sends data to the IP address and port from which it last received data. TCP server supports multiple remote clients connecting. Received data is parsed for various line endings optionally removing control characters and triggering an event for a received line. The only other two events are optional, one for state changed when starting and stopping, the second offering progress information and errors. A demo application testiplog.exe illustrates use of TMagIpLog as a TCP or UDP client or server, and both in the same program sending data locally. The same component may be used in a client or server application, to send or receive. Note: applications using this component also need OverbyteIcsLogger in application uses to satisfy the event type TLogOption. The Magenta Systems ComCap application may also be used to capture IP streams to files or a database. Using TMagIpLog: 1 - Drop the component onto a form (or create it in code, see testiplog.exe) 2 - Specify LogProtocol as one of logprotUdpClient, logprotUdpServer, logprotTcpServer, logprotTcpClient 3 - For client protocols, specify RemoteHost (name or IP address) and RemoteIpPort, CheckPing true if ping to be used, RetryAttempts to non-zero if continual retries not needed, RetryWaitSecs for delay between retries 4 - For server protocols, LocalIpAddress is 0.0.0.0 to listen on all local addresses, LocalIpPort must be non-zero. 5 - For sending data, AddCRLF to false if line already have terminating characters, UdpNoCRLF to false if UDP should send CRLF. 6 - For receiving data, LineEndType to one of lineendCR, lineendLF, lineendCustom (set in hex in CustomLineEnd) or lineendPacket (for UDP), then MaxLineLen if a line should be returned before lineend is found, StripControls to false if CR, LF, FF should not be removed from received data, RawData to true if nulls should not be removed. 7 - Assign onLogRecvEvent if data is to be received, onLogChangeEvent if tracking of start and stop is needed, onLogProgEvent if progress information is needed for logging. 8 - Call StartLogging. The LogChangeEvent and LogProgEvent will trigger when LogState changes to logstateOK when data may be sent. 9 - To send a line, if function GetAnyStateOK is true, call SendLogLine 10 - Received data will trigger LogRecvEvent once per line. 11 - Call StopLogging to stop. Buffered data may continue to be sent. after close, keep calling CheckStopped until true when it's really finished and component may be destroyed. To send to multiple clients, set MaxSockets to the number needed, then use the function SetRemotes to specify the remote host and port for each socket number, base 0. The events all return Socnr to indicate which socket. MaxSockets also specifies how many remote clients can connect to TCP Server, but note that Socnr is dynamic and changes as remote clients come and go. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be