What's the idiomatic way to do async socket programming in Delphi?

后端 未结 10 985
迷失自我
迷失自我 2021-01-04 19:18

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:

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 19:47

    Indy uses synchronous sockets because it's a simpler way of programming. The asynchronous socket blocking was something added to the winsock stack back in the Windows 3.x days. Windows 3.x did not support threads and there you couldn't do socket I/O without threads. For some additional information about why Indy uses the blocking model, please see this article.

    The .NET Socket.BeginRead/EndRead calls are using threads, it's just managed by the Framework instead of by you.

    @Roddy, Indy 10 has been bundled with Delphi since at Delphi 2006. I found that migrating from Indy 9 to Indy 10 to be a straight forward task.

提交回复
热议问题