Solved

Are Indy components based on blocking sockets?

Posted on 2009-05-14
5
495 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

813 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

13 Experts available now in Live!

Get 1:1 Help Now