首页 > 其他 > 详细

mormot2封装tcp

时间:2020-11-26 09:18:14      阅读:38      评论:0      收藏:0      [点我收藏+]

mormot2封装tcp

这没什么好惊奇的,http是基于tcp的应用层协议。

mormot.net.sock.pas

/// Fast low-level Socket implementation
// - direct access to the OS (Windows, Linux) network layer API
// - use Open constructor to create a client to be connected to a server
// - use Bind constructor to initialize a server
// - use SockIn and SockOut (after CreateSock*) to read/readln or write/writeln
// as with standard Delphi text files (see SendEmail implementation)
// - even if you do not use read(SockIn^), you may call CreateSockIn then
// read the (binary) content via SockInRead/SockInPending methods, which would
// benefit of the SockIn^ input buffer to maximize reading speed
// - to write data, CreateSockOut and write(SockOut^) is not mandatory: you
// rather may use SockSend() overloaded methods, followed by a SockFlush call
// - in fact, you can decide whatever to use none, one or both SockIn/SockOut
// - since this class rely on its internal optimized buffering system,
// TCP_NODELAY is set to disable the Nagle algorithm
// - our classes are (much) faster than the Indy or Synapse implementation
TCrtSocket = class

 

mormot.net.asynch.pas

/// implements a thread-pooled high-performance TCP server
// - will use a TAsynchConnection inherited class to maintain connection state
// for server process
TAsynchServer = class(TAsynchConnections)

 

/// implements thread-pooled high-performance TCP multiple clients
// - e.g. to run some load stress tests with optimized resource use
// - will use a TAsynchConnection inherited class to maintain connection state
// of each connected client
TAsynchClient = class(TAsynchConnections)

 

mormot2封装tcp

原文:https://www.cnblogs.com/hnxxcxg/p/14040297.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!