Overview
This class manages remote connections, and each remote connection corresponds to an instance of that class, which can be developed by inheriting the class, extending the properties, storing more connection information, and overriding the Onrecvbuffer method for data logic processing
"Field/Property description"
- Property remoteaddr:string read fremoteaddr;
Description: Remote connection IP.
- Property Remoteport:integer read Fremoteport;
Description: Remote connection port.
- Property Sockethandle:tsocket read Fsockethandle;
Description: Connect the socket.
"Method description"
- Procedure docleanup;virtual;
Description: This method executes the method when it obtains an object from the object pool (Tiocptcpserver.getclientcontext), performs cleanup of the related resources, and when the instance is no longer needed, is put back into the connection pool ( Tiocptcpserver.releaseclientcontext) also executes the method, which accesses and executes only one thread at a time.
- Procedure Postnextsendrequest; Virutal;
Note: The method will be called again to send the next request when the request is completed and successful (Tiocpsendrequest.handleresponse). The method will not be executed if the response finds that GetLastError is not 0 or if the service shutdown has stopped
- Procedure Onrecvbuffer (buf:pointer; len:cardinal; Errcode:word); Virtual
Description: If the execution of the function is triggered when the remote data is received, the method is called in response to a request to receive data from a post (tiocprecvrequest.handleresponse). The method is not executed if the response finds that GetLastError is not 0 or if the service shutdown has stopped.
==========================================
DIOCP Official Community | Mybean Official Community
http://www.diocp.org/
==========================================
"DIOCP Knowledge Base" Connection context Tiocpclientcontext