Solved

Indy | Client threads

Posted on 2004-08-01
4
182 Views
Last Modified: 2010-04-05
Hello,

If I have a IdTCPServer on my server app, and then have the IdTCPClient on the clients, should I
"Connect" to the server, do what I need to do, "disconnect" and "connect" later if I need to send more information to the server
or
"Connect" to the server, do statements... and leave the connection open until client app closes?

Thanks in advance...

Cërf.
0
Comment
Question by:Cerf
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
ceoworks earned 175 total points
ID: 11690162
Hi Cerf,

<should I "Connect" to the server, do what I need to do, "disconnect" and "connect" later if I need to send more information to the server or "Connect" to the server, do statements... and leave the connection open until client app closes?>

It depends on your needs. For example if you are developing a simple chat system, you should let them stay connected because in chat system, there will be a tons of message transfer between clients and server. So it wouldn't be a good idea to connect, send message then close. But if have an application which needs to send some data by the timer(for example once per 5 min..), you may think to :

(i) connect
(ii) transfer data
(iii) disconnect

HTH,

Oktay
0
 
LVL 8

Author Comment

by:Cerf
ID: 11691021
So, it doesn't really matter in a "safe" enviroment as a LAN...
I guess, I will go with "connect->transfer data-> do other stuff-> disconnect" since users should be done within a couple of minutes...

Thanks, Oktay.

I am interested in listening another opinion or two, so I will leave the Q open for one more day.
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 175 total points
ID: 11694019
Connecting every time will slow things down a bit thus it is advised to keep the connection open if you need to make many small transactions, like e.g. a chat program. However, if the amount of traffic isn't big or if you have limited bandwidth, it might be more useful to close connections again to free more resources while you don't need the connection.Keeping a connection closed is also useful because you might switch between servers that way. Thus, when you connect to System X and system X fails to connect, you connect to system Y instead. Close again and for the next call, Y might be busy so you connect to Z. (Or back yo X.)

Keeping the connection open is useful for chat programs. Keeping it closed is more useful for stuff like mail applications and webbrowsers.

If this is within a private LAN then internal bandwidth can be a problem if these are connections to a single server. If 500 employees are all connected at the same server then the server has a lot of resources in use, even if none of the users are exchanging data with it. Then again, the average, modern server should be able to handle such a low amount of users anyway...
0
 
LVL 8

Author Comment

by:Cerf
ID: 11695445
SO I guess I'm cool with having them open since it is a lab LAN, with a very few machines (no more than 20)
Thank you guys,
I am satisfied with your opinions,

Cërf.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

20 Experts available now in Live!

Get 1:1 Help Now