?
Solved

Client / Server question

Posted on 2004-11-19
4
Medium Priority
?
151 Views
Last Modified: 2010-04-05
Greertings

I have a delphi client (TIdTCPClient), that sends data to my server (TServerSocket). The data transmitted are a plain string with delimeted strings.

The client / server works fine, but at times it is a requirement that the client will really rapidly send data to the server ... With my testing it seems as if the data gets "lost".

For example, I transmit these strings, lets say, five different messages, directly after each other. When inspecting my database, I see that only two of them gets recorded. Should I, for testing purposes, perform a Sleep(500), between the transmitions of these strings, all is fine.

Any pointers will be appreciated.

Thanx in advance.
0
Comment
Question by:Engwi
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12626926
No, sleeps should not be required unless client nd server are ont the same system. Even then, I would use Sleep(0) instead of Sleep(500). Sleep(0) will just allow another thread to run it's cycle, thus if client and server are on the same system, the server thread would get a chance to read. If client and server are on different systems then it should not matter.
Maybe consider sending those multiple messages as one single, larger message...
0
 

Author Comment

by:Engwi
ID: 12627110
Workskop Alex

Thanks, indeed, my client and server are on same machine {Testing purposes}, and I just confirmed your comment with Sleep(0), the transmission was more successfulle this time round, although not 100% effective. From your comment then I do take it that the "sleeps" would not be required at all if client and server on different machine ??

I will award the points on your reply.

Thanks again.  
0
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 120 total points
ID: 12628897
do you connect/send the string/disconnect every time? by doing this you would probably get 100% but it would be a bit slower

or do you keep the connection open and just send strings?
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12634256
Sleeps are useless if client and server are on different systems. It's also useless if you use a multi-processor PC, since the sleep is only needed to give another process a bit of breathing space. But if you have more than one processor (e.g. with two PC's) then both client and server have their own breathing space.
For testing purposes it would be better to use two computers. But it isn't always a requirement. But if the server is too busy, it could happen that your connection will time-out in which case the message gets dropped. It should be possible to detect this time-out, btw. And if you detect a time-out, just resend the message again. Be aware that since you're doing something with a database on the server, this database stuff will most likely slow things down. What I would do in such a case is make sure that every message sent to the server is handled by it's own thread. But I guess you're already doing this.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

809 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