Difference between revisions of "TWSocket"

From Overbyte
Jump to navigation Jump to search
Line 31: Line 31:
 
| valign="top" | [[TWSocket.HSocket | HSocket]] |||| Winsock handle for underlaying socket.
 
| valign="top" | [[TWSocket.HSocket | HSocket]] |||| Winsock handle for underlaying socket.
 
|-
 
|-
| valign="top" | [[TWSocket.IcsLogger | IcsLogger]] ||||
+
| valign="top" | [[TWSocket.IcsLogger | IcsLogger]] |||| Linked component to log debug messages.
 
|-
 
|-
 
| valign="top" | [[TWSocket.LastError | LastError]] |||| Save the last error occured during socket operation.
 
| valign="top" | [[TWSocket.LastError | LastError]] |||| Save the last error occured during socket operation.
 
|-
 
|-
| valign="top" | [[TWSocket.LineEcho | LineEcho]] |||| Echo all received characters back to tramitter.
+
| valign="top" | [[TWSocket.LineEcho | LineEcho]] |||| Echo all received characters back to transmitter.
 
|-
 
|-
 
| valign="top" | [[TWSocket.LineEdit | LineEdit]] |||| Handle received control characters used for editing.
 
| valign="top" | [[TWSocket.LineEdit | LineEdit]] |||| Handle received control characters used for editing.
Line 47: Line 47:
 
| valign="top" | [[TWSocket.LineMode | LineMode]] |||| Use [[TWSocket.LineEnd | LineEnd]] as end of line marker to trigger [[TWSocket.OnDataAvailable | OnDataAvailable]].
 
| valign="top" | [[TWSocket.LineMode | LineMode]] |||| Use [[TWSocket.LineEnd | LineEnd]] as end of line marker to trigger [[TWSocket.OnDataAvailable | OnDataAvailable]].
 
|-
 
|-
| valign="top" | [[TWSocket.LingerOnOff | LingerOnOff]] ||||
+
| valign="top" | [[TWSocket.LingerOnOff | LingerOnOff]] |||| Select linger mode.
 
|-
 
|-
| valign="top" | [[TWSocket.LingerTimeout | LingerTimeout]] ||||
+
| valign="top" | [[TWSocket.LingerTimeout | LingerTimeout]] |||| Select linger timeout.
 
|-
 
|-
 
| valign="top" | [[TWSocket.ListenBacklog | ListenBacklog]] |||| Size of pending connection queue in server mode.
 
| valign="top" | [[TWSocket.ListenBacklog | ListenBacklog]] |||| Size of pending connection queue in server mode.
Line 57: Line 57:
 
| valign="top" | [[TWSocket.LocalPort | LocalPort]] |||| The local port where the socket is bound to.
 
| valign="top" | [[TWSocket.LocalPort | LocalPort]] |||| The local port where the socket is bound to.
 
|-
 
|-
| valign="top" | [[TWSocket.MultiCast | MultiCast]] ||||
+
| valign="top" | [[TWSocket.MultiCast | MultiCast]] |||| Select multicast.
 
|-
 
|-
| valign="top" | [[TWSocket.MultiCastAddrStr | MultiCastAddrStr]] ||||
+
| valign="top" | [[TWSocket.MultiCastAddrStr | MultiCastAddrStr]] |||| Select multicast address.
 
|-
 
|-
| valign="top" | [[TWSocket.MultiCastIpTTL | MultiCastIpTTL]] ||||
+
| valign="top" | [[TWSocket.MultiCastIpTTL | MultiCastIpTTL]] |||| Select multicast Time To Live.
 
|-
 
|-
 
| valign="top" | [[TWSocket.MultiThreaded | MultiThreaded]] |||| Set when TWSocket has to use his own message pump.
 
| valign="top" | [[TWSocket.MultiThreaded | MultiThreaded]] |||| Set when TWSocket has to use his own message pump.
Line 91: Line 91:
 
| valign="top" | [[TWSocket.SendFlags | SendFlags]] |||| How to send data.
 
| valign="top" | [[TWSocket.SendFlags | SendFlags]] |||| How to send data.
 
|-
 
|-
| valign="top" | [[TWSocket.SocksAuthentication | SocksAuthentication]] ||||
+
| valign="top" | [[TWSocket.SocksAuthentication | SocksAuthentication]] |||| Select socks server authentication mode.
 
|-
 
|-
| valign="top" | [[TWSocket.SocksLevel | SocksLevel]] ||||
+
| valign="top" | [[TWSocket.SocksLevel | SocksLevel]] |||| Select socks server protocol level.
 
|-
 
|-
| valign="top" | [[TWSocket.SocksPassword | SocksPassword]] ||||
+
| valign="top" | [[TWSocket.SocksPassword | SocksPassword]] |||| Password for socks server authentication.
 
|-
 
|-
 
| valign="top" | [[TWSocket.SocksPort | SocksPort]] |||| Port number for socks server.
 
| valign="top" | [[TWSocket.SocksPort | SocksPort]] |||| Port number for socks server.

Revision as of 10:54, 2 March 2006

Main page -> ICS component reference -> TWSocket

Overview

unit WSocket.pas
inheritance

TWSocket component is implementing the TCP protocol described in RFC 793 and and UDP protocol described in RFC 768. Both protocols are encaptulated by the IP protocol described in RFC 791. TWSocket is used in almost every other ICS component.

TWSocket component can be used as client or a server. For its use as TCP server however TWSocketServer is encouraged because of his advanced features.

Properties

Addr Client: The host to connect to. Server: The interface to listen on.
AllSent
BufSize Size in bytes for dynamic send buffer cells.
ComponentOptions Used to modify how the component handle some operations.
DnsResult Typically called in OnDnsLookupDone. The IP address of the remote host given as argument to DnsLookup.
DnsResultList Similar to DnsResult but a TStringList containing the multiple IP's of the host if appropriate.
Handle Handle for the underlaying hidden window.
HSocket Winsock handle for underlaying socket.
IcsLogger Linked component to log debug messages.
LastError Save the last error occured 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 ot trigger OnDataAvailable.
LineLength When using LineMode: the length of the received line.
LineLimit Maximum line lenght to receive before triggering OnLineLimitExceeded. See also DOS attac.
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 where the socket is bound to.
LocalPort The local port where the socket is bound to.
MultiCast Select multicast.
MultiCastAddrStr Select multicast address.
MultiCastIpTTL Select multicast Time To Live.
MultiThreaded Set when TWSocket has to use his own message pump.
PeerAddr The remote address where the socket is bound to.
PeerPort The remote port port where the socket is bound to.
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 or tcp.
RcvdCnt Number of character received in internal buffer when using line mode.
RcvdCount Number of characters in receive buffer but not read yet.
RcvdPtr Internal rceive 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 To be set to terminate synchronous operation prematurely.
Text Equivalent to ReceiveStr and SendStr.

Methods

Abort Quick and dirty way to close the socket.
Accept Accept a new connection.
CancelDnsLookup Cancel any pending DNS lookup.
Close Close the socket gracefull.
CloseDelayed Close the socket when the current event terminate.
Connect Connect to a remote host.
Create Dynamcly create the component.
DeleteBufferedData Delete internaly buffered data.
Destroy Destroy the dynamicly 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 to avoid this method.
GetPeerAddr Returns the remote address where the socket has been bound. See also PeerAddr.
GetPeerName Returns the remot hostname where the socket has been bound.
GetPeerPort Returns the remote port where the socket has been bound. See also PeerPort.
GetSockName
GetXAddr Returns the local interface to where the socket has been bound.
GetXPort Returns the local port to where the socket has been bound.
Listen Set the socket in listening state to accept inbound connections.
MessageLoop Pump messages until WM_QUIT is received.
MessagePump Trigger OnMessagePump or call ProcessMessages.
Pause Stop delivery notification of received TCP data.
PeekData
ProcessMessage Similar as TApplication.ProcessMessage.
ProcessMessages Similar as TApplication.ProcessMessages.
PutDataInSendBuffer Put data in send buffer without sending it.
PutStringInSendBuffer Put string in send buffer without sending it.
Receive Receive data (to be called from OnDataAvailable).
ReceiveFrom Same as Receive but returns the sender address.
ReceiveStr Receive string (To be called from OnDataAvailable).
Release Destroy the dynamicly created TWSocket in a custom message handler.
Resume Resume winsock event notifications.
ReverseDnsLookup
Send Send data.
SendStr Send a string.
SendTo Send data to a given remote (UDP).
SetLingerOption
Shutdown Close the socket gracefull.
TimerClear
TimerCmp
TimerIsSet
ThreadAttach Attach to the current thread.
ThreadDetach Detach from the current thread.
WaitForClose Wait until the socket is closed. Better to avoid this method.

Events

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
OnDnsLookupDone DNSLookup has finished.
OnError Discouraged, use exception handling instead.
OnLineLimitExceeded Denial of service attack
OnMessagePump To call your own message pump.
OnSendData Winsock send buffer is empty, will be filled again by internal send buffer if still data available to send.
OnSessionAvailable Client connected to this server.
OnSessionClosed Socket has closed.
OnSessionConnected Session to host etablished.
OnSocksAuthState
OnSocksConnected
OnSocksError

How to



ICS Components Reference