Solved

Indy | Client threads

Posted on 2004-08-01
4
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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