Solved

Indy | Client threads

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
A short film showing how OnPage and Connectwise integration works.

932 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

9 Experts available now in Live!

Get 1:1 Help Now