软件设计:带有 ClientDataSet 和套接字的第 2 层应用程序
我的任务是创建第 2 层应用程序,如下所示:
MSSQL 数据库 <-> 服务器<-> n-Client(n 代表多个)
客户端向服务器发送数据。 服务器从数据库中选择内容,然后将其发送回客户端。 目前我正在使用 Records 和 SendDataToSocket(网址如下)执行此操作。
我想在客户端上使用 TDBGrid,使用通过套接字从服务器接收的数据。目前情况如下:
服务器: 数据库-> ADO查询-> 数据集提供者-> 客户端数据集-> SaveToStream(MemoryStream)
客户端: 客户端数据集-> LoadFromStream(内存流)-> 数据源-> DBGrid
所以我想要做的就是将服务器端的clientdataset创建的流发送给使用loadfromstream读取流的客户端。 SendDataToSocket 在这里可行吗?
我希望你明白我的意思。
I have the task to create a tier 2 application as follows:
MSSQL Database <-> Server <-> n-Client (n for many)
The client sends data to the server. The server selects stuff from the database and then sends it back to the client. Currently I am doing that with Records and SendDataToSocket(url is below).
I want to use TDBGrid on the client using data received via sockets from the server. At the moment it goes like this:
Server:
DB -> ADOQuery -> DataSetProvider -> ClientDataSet -> SaveToStream(MemoryStream)
Client:
ClientDataSet -> LoadFromStream(MemoryStream) -> DataSource -> DBGrid
So what I want to do is send the stream the clientdataset on the server side creates to the client who uses loadfromstream to read the stream. Is the SendDataToSocket viable here?
I hope you get what I mean.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,只要客户端准备好接收数据即可。 这会很好地工作,但是根据您可能希望在发送之前压缩内存流的数据量和类型。 我在之前的项目中也执行过类似的方法,但我使用 synapse 进行数据传输...但基本概念是相同的。
zlib 单元(由 CodeGear 包含)包含一个围绕流的简单包装器,可提供压缩和解压缩。 由于您控制连线的两侧,因此压缩很可能会通过减少连线时间来提高性能。
Yes, as long as the client was ready to receive the data. This would work well, however depending on the amount and type of data you might want to compress the memory stream prior to sending. I have performed a similar approach in previous projects, but I used synapse for the data transfer...but the basic concept was the same.
The zlib unit (included by CodeGear) contains a simple wrapper around a stream which provides compression and decompression. Since your controlling both sides of the wire, compression will most likely increase performance by reducing wire time.