Solved

Indy | Client threads

Posted on 2004-08-01
4
186 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 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