From Overbyte
Jump to: navigation, search

Main page -> ICS component reference -> TWSocket


unit OverbyteIcsWSocket.pas
inheritance TCustomThrottledWSocket (optional) -> TCustomTimeoutWSocket (optional) -> TCustomSyncWSocket -> TCustomLineWSocket -> TCustomSslWSocket (optional) -> TCustomSocksWSocket -> TCustomSocksWSocket -> TCustomHttpTunnelWSocket -> TCustomWSocket -> TIcsWndControl (*Optional = Depending on preprocessors)

TWSocket component is implementing the TCP protocol described in RFC 793 and the UDP protocol described in RFC 768. TWSocket is used in almost every other ICS component.

TWSocket component can be used as client as well as a Server socket (listening). For use as a TCP server however TWSocketServer is encouraged because it provides advanced features.


Addr Client: The host to connect to. Server: The interface to listen on.
AllSent Boolean indicating if all data in internal buffer has been sent.
BufSize Size in bytes for dynamic send buffer calls.
ComponentOptions Used to modify how the component handles some operations.
DnsResult Typically called in OnDnsLookupDone. The IP address of the remote host given as an argument to DnsLookup.
DnsResultList Similar to DnsResult but a TStringList containing the multiple IPs of the host, if appropriate.
Handle Handle for the underlying hidden window.
HSocket Winsock handle for underlying socket.
IcsLogger Linked component to log debug messages.
LastError The last error occurred during socket operation.
LineEcho Echo all received characters back to transmitter.
LineEdit Handle received control characters used for editing.
LineEnd End of line character(s) used to trigger OnDataAvailable.
LineLength When using LineMode: the length of the received line.
LineLimit Maximum line length to receive before triggering OnLineLimitExceeded. See also DOS attack.
LineMode Use LineEnd as end of line marker to trigger OnDataAvailable.
LingerOnOff Select linger mode.
LingerTimeout Select linger timeout.
ListenBacklog Size of pending connection queue in server mode.
LocalAddr The local address to which the socket is bound.
LocalPort The local port to which the socket is bound.
MultiCast Select multicast.
MultiCastAddrStr Select multicast address.
MultiCastIpTTL Select multicast "Time to Live".
MultiThreaded Set when TWSocket must use its own message pump.
PeerAddr The remote address to which the socket is bound.
PeerPort The remote port to which the socket is bound.
Port Client: The port to connect to. Server: The port to listen on.
PortNum Integer value of Port.
Proto The protocol to use, can be tcp, udp or raw.
RcvdCnt Number of characters received in internal buffer when using line mode.
RcvdCount Number of characters in receive buffer but, not read.
RcvdPtr Internal receive buffer pointer used for line mode.
ReadCount Total number of bytes received.
ReqVerLow Low part of winsock version to load.
ReqVerHigh High part of winsock version to load.
ReuseAddr Should the compnent try to reuse an address.
SendFlags How to send data.
SocksAuthentication Select socks server authentication mode.
SocksLevel Select socks server protocol level.
SocksPassword Password for socks server authentication.
SocksPort Port number for socks server.
SocksServer IP or hostname for socks server.
SocksUsercode Usercode for socks server authentication.
State Current state of the socket; mainly used for log or display purposes.
Terminated Set to terminate synchronous operation prematurely.
Text Equivalent to ReceiveStr and SendStr.


Abort Quick and dirty way to close the socket.
Accept Accept a new incomming connection request.
CancelDnsLookup Cancel any pending DNS lookup.
Close Close the socket gracefully.
CloseDelayed Close the socket when the current event terminates.
Connect Connect to a remote host.
Create Dynamically create the component.
DeleteBufferedData Delete internal buffered data.
Destroy Destroy the dynamically created component.
DnsLookup Perform a DNS lookup of a hostname in background. See also OnDNSLookupDone.
Dup Assign a socket handle to the component.
Flush Wait until the internal buffer is flushed. Better avoid this method.
GetPeerAddr Returns the remote address the socket is bound. See also PeerAddr.
GetPeerName Returns the remote hostname the socket is bound.
GetPeerPort Returns the remote port the socket has is bound. See also PeerPort.
GetSockName Returns socket binding information.
GetXAddr Returns the local interface the socket is bound.
GetXPort Returns the local port the socket is been bound.
Listen Set the socket state to "listening" to accept inbound connections.
MessageLoop Pump messages until WM_QUIT is received.
MessagePump Trigger OnMessagePump or call ProcessMessages.
Pause Stop delivery notifications of received TCP data.
PeekData Read received data without removing it from the buffer.
ProcessMessage Similar to TApplication.ProcessMessage.
ProcessMessages Similar to TApplication.ProcessMessages.
PutDataInSendBuffer Put data in the send buffer without sending the data.
PutStringInSendBuffer Put a string in the send buffer without sending the data.
Receive Receive data (to be called within OnDataAvailable).
ReceiveFrom Same as "Receive" but, also returns the sender address.
ReceiveStr Receive string (to be called within OnDataAvailable).
Release Destroy the dynamically created TWSocket in a custom message handler.
Resume Resume winsock event notifications.
ReverseDnsLookup Start an asynchronous reverse DNS lookup.
Send Send data.
SendStr Send a string.
SendTo Send data to a given remote socket (UDP only).
SetLingerOption Set the "linger" options defined by LingerOnOff and LingerTimeout
Shutdown Close the socket gracefully.
TimerClear Clear a linger timer.
TimerCmp Compare linger timer.
TimerIsSet Check a linger timer.
ThreadAttach Attach to the current thread.
ThreadDetach Detach from the current thread.
WaitForClose Wait until the socket is closed. Better avoid this method.


OnBgException Background exception occured.
OnChangeState State of TWSocket has changed.
OnDataAvailable Data available in internal receive buffer.
OnDataSent Internal sent buffer is completely delivered to winsock.
OnDebugDisplay To display debugging messages.
OnDnsLookupDone DNSLookup has finished.
OnError Discouraged, use exception handling instead.
OnLineLimitExceeded A message longer than "LineLimit" has been received.
OnMessagePump To call your own message pump.
OnSendData Winsock send buffer is empty, will be filled again by internal send buffer if data available to send.
OnSessionAvailable Client connected to this server.
OnSessionClosed Socket has closed.
OnSessionConnected Session to host etablished.
OnSocksAuthState State of the socks authentication process.
OnSocksConnected Connected to the socks server.
OnSocksError Triggered when an error occurs with socks server.

How to

ICS Components Reference