Difference between revisions of "Midware TClientWSocket"

From Overbyte
Jump to navigation Jump to search
Line 6: Line 6:
 
|}
 
|}
  
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.
+
TClientWSocket is a specialized TWSocket used to handle client connection with application server. A new TClientWSocket is instanciated by [[Midware_TAppServer | 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.
+
Do not confuse TClientWSocket with [[Midware_TAppSrvClient | TAppSvrClient]] which is the client application side. TClientWSocket is used on the server side to handle client connections, [[Midware_TAppSrvClient | TAppSvrClient]] 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 [[Midware_TAppServer | TAppServer]] and accessed thru his ClientWSocket indexed property or thru reference passed by events such as OnClientCommand.
  
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 ==
 
== Properties ==
 
{|  
 
{|  

Revision as of 15:20, 24 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 TAppSvrClient which is the client application side. TClientWSocket is used on the server side to handle client connections, TAppSvrClient 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.
OnTimeout Occurs when client will be disconnected because of no activity.

How to


Midware Components Reference