在Delphi中进行异步套接字编程的惯用方法是什么? [英] What's the idiomatic way to do async socket programming in Delphi?

查看:164
本文介绍了在Delphi中进行异步套接字编程的惯用方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我以前对这个问题的研究:

p>

Indy 组件似乎完全同步。另一方面,当ScktComp单元使用WSAAsyncSelect时,它基本上只是同步一个BSD风格的多路复用套接字应用程序。您将被转储在单个事件回调中,就好像您刚刚从循环中的select()返回,并且必须自己执行所有的状态机导航。



.NET的情况比Socket.BeginRead / Socket.EndRead好一些,其中继承是直接传递给Socket.BeginRead,那就是你选择的地方。一个连续的编码作为一个闭包显然有你需要的所有上下文,等等。

解决方案

对于异步的东西,尝试ICS



http: /www.overbyte.be/frame_index.html?redirTo=/products/ics.html


What is the normal way people writing network code in Delphi use Windows-style overlapped asynchronous socket I/O?

Here's my prior research into this question:

The Indy components seem entirely synchronous. On the other hand, while ScktComp unit does use WSAAsyncSelect, it basically only asynchronizes a BSD-style multiplexed socket app. You get dumped in a single event callback, as if you had just returned from select() in a loop, and have to do all the state machine navigation yourself.

The .NET situation is considerably nicer, with Socket.BeginRead / Socket.EndRead, where the continuation is passed directly to Socket.BeginRead, and that's where you pick back up. A continuation coded as a closure obviously has all the context you need, and more.

解决方案

For async stuff try ICS

http://www.overbyte.be/frame_index.html?redirTo=/products/ics.html

这篇关于在Delphi中进行异步套接字编程的惯用方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆