Difference between revisions of "Midware TClientWSocket"

From Overbyte
Jump to navigation Jump to search
Line 77: Line 77:
 
| valign="top" | [[Midware_TClientWSocket.OnDisplay | OnDisplay]] |||| Occurs when a message has to be displayed on the user interface.
 
| valign="top" | [[Midware_TClientWSocket.OnDisplay | OnDisplay]] |||| Occurs when a message has to be displayed on the user interface.
 
|-
 
|-
| valign="top" | [[Midware_TClientWSocket.OnOverflow | OnOverflow]] |||| Triggered when the input buffer is overflowed and can't be enlarged.  
+
| valign="top" | [[Midware_TClientWSocket.OnOverflow | OnOverflow]] |||| Occurs when the input buffer is overflowed and can't be enlarged.
 
|-
 
|-
 
| valign="top" | [[Midware_TClientWSocket.OnSessionClosed | OnSessionClosed]] |||| Occurs when client disconnect from server or has been disconnected.
 
| valign="top" | [[Midware_TClientWSocket.OnSessionClosed | OnSessionClosed]] |||| Occurs when client disconnect from server or has been disconnected.

Revision as of 14:25, 14 May 2011

Main page -> Midware component reference -> TClientWSocket

Overview

unit ApSrvCli.pas

TClientWSocket is a specialized TWSocket used to handle client connection with application server. A new TClientWSocket is instanciated by TAppServer when a client connect to the server. TClientWSocket is destroyed after client disconnect.

Do not confuse TClientWSocket with TAppSrvClient which is the client application side. TClientWSocket is used on the server side to handle client connections, TAppSrvClient is used on the client side to connect to the application server. Both components are talking to each other.

User code in an ordinary application server never create a TClientWSocket instance. Instead, it uses instances created by TAppServer and accessed thru his ClientWSocket indexed property or thru reference passed by events such as OnClientCommand.

Properties

Banner The banner to be sent to the client upon connection. Must be a single line.
Busy Busy is TRUE while a the previous request is still executing.
CommandCount Number of commands issued by the client. Useful for statistics or accounting purposes.
CommandTimeout Timeout value.
ConnectedSince Gives the time when the client connected.
HSocket HSocket is the underlaying winsock DLL handle for the connection handled by TClientWSocket component.
LastCommandTime Gives the time of the last command received from client.
LocalPort LocalPort gives the port number (or service name) associated by winsock on the local computer for the connection made by client.
PeerAddr Store the client's IP address.
RcvBuf The actual buffer used to store incomming data.
RcvdCount Returns the number of characters received and not yet read.
RcvSize Size of buffer used to receive commands (requests).
RcvSizeInc When RcvBuf is too small, it will be enlarged by RcvSizeInc bytes automatically until RcvSizeMax is reached.
RcvSizeMax When RcvBuf is too small, it will be enlarged by RcvSizeInc bytes automatically until RcvSizeMax is reached.
ReplyHeader ReplyHeader point to the header built by the TAppServer based on reply status.
ReplyheaderLen ReplyHeaderLen is the length in byte for the header.
ReplyBody ReplyBody point to the answer to be sent to the client.
ReplyBodyLen ReplyBodyLen is the length in bytes for the answer.
UserData UserData is not used by the component nor the TAppServer component.

Methods

CheckCommandTimeout Procedure used by TAppServer to check for inactivity timeout.
Dup Dup associate a winsock handle to a TClientWSocket component.
GetPeerAddr
SendReply SendReply procedure will send ReplyHeader and About MidWare followed by a CR/LF pair.
StartConnection First method to be invoked on client connection.

Events

OnBgException Occurs when an exception is thrown in the background.
OnCommand Occurs when a command has been received from client.
OnDisplay Occurs when a message has to be displayed on the user interface.
OnOverflow Occurs when the input buffer is overflowed and can't be enlarged.
OnSessionClosed Occurs when client disconnect from server or has been disconnected.
OnTimeout Triggered when the client timedout as is about to be disconnected by TAppServer.

How to


Midware Components Reference