Solved

Are Indy components based on blocking sockets?

Posted on 2009-05-14
5
493 Views
Last Modified: 2013-11-23

  hi experts,

       Delphi Indy components are based on blocking sockets. Why they are designed as blocking sockets style.
 
               Can you please explain me.
0
Comment
Question by:inampudi1
5 Comments
 
LVL 6

Accepted Solution

by:
twocandles earned 125 total points
ID: 24383390
Here you have Indy team explanation:

http://www.swissdelphicenter.ch/en/showarticle.php?id=4
0
 
LVL 5

Assisted Solution

by:wd123
wd123 earned 125 total points
ID: 24383419
0
 
LVL 12

Assisted Solution

by:Hypo
Hypo earned 125 total points
ID: 24383539
Yes,
Indy components are based on blocking sockets, and my guess why they are is that blocking sockets is actually easier and offer a much more robust way of working with network communication than what non-blocking sockets do.

A couple of years ago I worked for a company on quite a large application that was using non-blocking sockets (It was using the native VCL TServerSocket/TClientSocket) to communicate with different modules over TCP/IP. It worked fine most of the time, but sometimes I would run into problems; like for instance when I had to have a two way communication from within a function in my code, where the response from the clients would influence how the function would react next; and the Event based messaging just forced my function to be transformed into some kind of state machine, where variables in my code had to keep track of waht state the communication with the clients where in for different functions. If the application would have used blocking sockets, then I could have just written my function straight up, but with the non-blocking sockets it was just not possible to do in a good way.

When I used Indy for the first time after that experience, it became clear to me how much easier my work would have been if they had used blocking sockets instead of non-blocking sockets.

Sure, It's faster to start working with non-blocking sockets in a GUI-application, since it fit's the whole event based structure, and that the application itself don't freeze when it waits for a response; also, using blocking sockets require that you know thread programming quite well, and are used to doing good exception handling, but if you do know these stuff, then I think you will see that in the long run, when the communication becomes a little bit more advanced than just sending and receiving simple messages, there are benefits of using blocking sockets over non-blocking.

regards
Hypo
0
 
LVL 19

Assisted Solution

by:MerijnB
MerijnB earned 125 total points
ID: 24384433
With Hypo,

I just want to add that (imho) the choice between blocking and non-blocking really depends on what kind of data you are going to transmit. If it's a protocol where a response from a client has influence on what to do next (like Hypo describes), blocking is surely the better option. In other cases non-blocking is easier to grasp (and thus better).
I find that I tend to design my protocol designs in such a way that I can use them with non-blocking sockets, just because I like working with non-blocking so much better.

Personally I use ICS when working with non-blocking sockets: http://www.overbyte.be/frame_index.html
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Some time ago I was asked to set up a web portal PC to put at our entrance. When customers arrive, they could see a webpage 'promoting' our company. So I tried to set up a windows 7 PC as a kiosk PC.......... I will spare you all the annoyances I…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now