简体   繁体   English

Indy或ICS还是?

[英]Indy or ICS or ?

Can any one tell me which is more stable? 谁能告诉我哪个更稳定? I know each has their own advantages and disadvantages. 我知道每个人都有自己的优点和缺点。 But which one is better for http, etc? 但哪一个更适合http等?

In my previous application I used indy9 but I wasn't satisfied with it, as I would sometimes get strange errors. 在我之前的应用程序中,我使用了indy9,但我对它不满意,因为我有时会遇到奇怪的错误。

Can anyone recommend one? 谁能推荐一个人?

I use Indy in a lot of projects. 我在许多项目中使用Indy。 I used both 9 and 10 mainly as HTTP server and proxy. 我主要使用9和10作为HTTP服务器和代理。 The projects get very intense traffic at times (HTTP). 项目有时会得到非常密集的流量(HTTP)。 Indy never did let me down. Indy从来没有让我失望过。 It works very stable. 它非常稳定。

But I also had some "strange" situations where I had to dig deep to find the underlying problem. 但我也有一些“奇怪”的情况,我不得不深入挖掘以找到潜在的问题。 I also do not like the way Indy tends to handle a lot of things through exceptions. 我也不喜欢Indy倾向于通过异常处理很多事情的方式。 In general I like the ICS coding style more. 总的来说,我更喜欢ICS编码风格。 But let me go to ICS. 但是让我去ICS。

ICS uses non-blocking sockets, while indy uses blocking. ICS使用非阻塞套接字,而indy使用阻塞。 While non-blocking is ok and seems to be better at first sight, I found it irritating in a lot of situations. 虽然非阻塞是可以的,并且乍一看似乎更好,但我发现它在很多情况下都很烦人。 The problem is that the natural flow of the code gets lost because of the callback functions. 问题是由于回调函数,代码的自然流动会丢失。 This makes it harder to write procedural type of libraries. 这使得编写过程类型的库变得更加困难。 Furthermore I do not like how everything is handled through messages. 此外,我不喜欢通过消息处理所有事情。 For me it gets messy real quick when mixed with multithreading. 对我来说,当与多线程混合时,它会变得非常混乱。 And multithreading is mainstream these days. 多线程最近成为主流。

So while I like the coding style and quality of the code in ICS, I prefer the simplicity of use and blocking mode of Indy. 因此,虽然我喜欢ICS中代码的编码风格和质量,但我更喜欢Indy的简单使用和阻塞模式。 What you like more is up to you, but both libraries are mature and stable. 你更喜欢什么取决于你,但这两个库都是成熟稳定的。

These are my two cents. 这是我的两分钱。

I also use both Indy and ICS. 我也同时使用Indy和ICS。

Most of the time I prefer Indy because implementing sequential type of protocols with it is very easy (the request runs in it's own thread so you simply Read/Write to the connection, really easy). 大多数时候我更喜欢Indy,因为用它实现顺序类型的协议非常容易(请求在它自己的线程中运行,所以你只需要读取/写入连接,非常简单)。 Using Indy requires solid knowledge of threading and synchronization. 使用Indy需要扎实的线程和同步知识。 Unlike Runner I like how Indy uses Exceptions to handle "exceptional" stuff because it allows me to concentrate on the normal flow of the protocol (I use try-finally blocks to make sure I deallocate resources). 与Runner不同,我喜欢Indy使用异常来处理“异常”的东西,因为它允许我专注于协议的正常流程(我使用try-finally块来确保我释放资源)。

I also used ICS in a application where Indy simply failed: I used it for an application that implements an TCP/IP proxy. 我还在Indy完全失败的应用程序中使用了ICS:我将它用于实现TCP / IP代理的应用程序。 Using ICS was simpler because of it's non-blocking nature. 使用ICS更简单,因为它具有非阻塞性。 I was able to "proxy" TCP/IP protocols that I know nothing about, so I have no idea how bytes would flow from one end to the other. 我能够“代理”我不了解的TCP / IP协议,所以我不知道字节将如何从一端流向另一端。 Indy failed in that scenario because in Indy you're ether reading or you're writing, you can't do both at the same time. Indy在那种情况下失败了,因为在Indy你是以太读书或者你在写作,你不能同时做两件事。 Using ICS to implement an sequential-type protocol is a bit of pain: you essentially need to use state-machine logic, brake the protocol in small bits, keep flags laying around so you know where you are in the protocol. 使用ICS实现顺序类型协议有点痛苦:您基本上需要使用状态机逻辑,以小位制动协议,保持标记,以便您知道协议中的位置。 An big plus: François Piette, the author of ICS, is active and very helpful on a number of forums and mailing list, and is very prompt to help with anything related to ICS. 一个很大的优点:ICS的作者FrançoisPiette在许多论坛和邮件列表中非常活跃并且非常有帮助,并且非常及时地帮助处理与ICS相关的任何事情。

For me, if I need to do something with TCP/IP, the decision path is very simple: Can it be done with Indy? 对我来说,如果我需要使用TCP / IP做一些事情,决策路径非常简单:可以用Indy完成吗? Then it's Indy. 然后是Indy。 If it can't be done with Indy then it'll be done with ICS! 如果不能用Indy完成那么它将用ICS完成!

I've used Indy 9 and 10 for TCP, HTTP and FTP with very few problems. 我已经将Indy 9和10用于TCP,HTTP和FTP,但问题很少。 ICS is a good choice, too. ICS也是一个不错的选择。 It's non blocking, which will change how you use it. 它是非阻塞的,会改变你使用它的方式。

I haven't used it, but I've heard good things about Synapse , which is also blocking. 我没有用它,但我听说Synapse也很好,它也是阻塞的。

We test Indy10 IdTCPClient to receive video stream from remote server, it's OK. 我们测试Indy10 IdTCPClient从远程服务器接收视频流,没关系。 But when it's receiveing stream, the same time use it send some data to the server, after some minute, the received stream data began lost data bytes. 但是当它接收流时,同时使用它向服务器发送一些数据,一段时间后,接收到的流数据开始丢失数据字节。 We use sniffer tool to trace this problem, confirmed that IdTCPClient lost some bytes in receiveing stream. 我们使用sniffer工具来跟踪这个问题,确认IdTCPClient在接收流中丢失了一些字节。

So, we test Indy9.018, the same problem happend but a few times VS. 所以,我们测试了Indy9.018,同样的问题发生了几次VS. Indy 10. Indy 10。

Remember that Indy is always in beta stage. 请记住,Indy始终处于测试阶段。 Sometimes you need to work with night builds. 有时您需要使用夜间构建。

I'd say the answer depends on what you want to do with the internet. 我会说答案取决于你想用互联网做什么。 Indy is fine if you are prepared to get involved with understanding how it works, and is very capable. Indy很好,如果你准备参与了解它是如何工作的,并且非常有能力。 ICS is a different take on things, and I've used it effectively for many-connection systems. ICS是一个不同的东西,我已经有效地将它用于多连接系统。 But for day to day "grab a file or send an email" type stuff, where you want to do a basic task, I pretty much always use Clever Components Internet Suite as you just create the component, set the options, and it works. 但是对于日常“抓取文件或发送电子邮件”类型的东西,你想要做一个基本的任务,我几乎总是使用Clever Components Internet Suite,因为你只是创建组件,设置选项,它的工作原理。 The suite is quite comprehensive, and gets useful updates. 该套件非常全面,并且可以获得有用的更新。

Which one is better really depends on specific use case, but I was unhappy with indy as an http client and ICS ended up being exactly what I needed it to be, with a lot less random quirks. 哪一个更好取决于具体的用例,但我对indy作为一个http客户端感到不满意,而ICS最终正是我需要的那样,随机怪癖的次数要少得多。

Note though that it is non blocking, so it's not just a drop in replacement. 请注意,虽然它是非阻塞的,但它不仅仅是替代品。

我使用Indy 9为超过100万用户提供稳定,发布的生产代码,并且从未收到过任何奇怪的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM