enigmasolutions
asked on
When to use Indy TcpServer.IOHandler.WriteBufferOpen
Hi,
In our application I notice we are using IOHandler.WriteBufferOpen as follows:
On the client AND on the server we are doing something like this...
Connection.IOHandler.Write BufferOpen ;
try
Connection.IOHandler.Write ( Some Stream Data )
Connection.IOHandler.Write BufferFlus h;
Connection.IOHandler.Write BufferClos e;
except
Connection.IOHandler.Write BufferCanc el;
end;
Our application is a typical client server application (an accounting software package actually) where the client sends small requests for data and the server returns varying size streams of data.
We are getting problems connecting to a server that is running on a very poor internet connection (3rd World Country - 256kbps internet).
A short packet of information such as the initial login works. But then we get Read Timeouts when a slightly larger packet of information is being sent from the server to our client. Interestingly, we don't get any problem sending huge data the other way (even with writebuffer used on our client) - I guess that is because our internet technology is much better.
I am most interested in QUESTION 2 (below) because I want to understand wny my developers may have used it.
Question 1 - Should we get rid of the WriteBuffer code?
Question 2 - In what scenarios would you use WriteBuffer?
Question 3 - Please confirm - Setting UseNaggle:=false will not help?
Question 4 - Please confirm - Setting that ReuseSocket:=rsTrue will not help?
In our application I notice we are using IOHandler.WriteBufferOpen as follows:
On the client AND on the server we are doing something like this...
Connection.IOHandler.Write
try
Connection.IOHandler.Write
Connection.IOHandler.Write
Connection.IOHandler.Write
except
Connection.IOHandler.Write
end;
Our application is a typical client server application (an accounting software package actually) where the client sends small requests for data and the server returns varying size streams of data.
We are getting problems connecting to a server that is running on a very poor internet connection (3rd World Country - 256kbps internet).
A short packet of information such as the initial login works. But then we get Read Timeouts when a slightly larger packet of information is being sent from the server to our client. Interestingly, we don't get any problem sending huge data the other way (even with writebuffer used on our client) - I guess that is because our internet technology is much better.
I am most interested in QUESTION 2 (below) because I want to understand wny my developers may have used it.
Question 1 - Should we get rid of the WriteBuffer code?
Question 2 - In what scenarios would you use WriteBuffer?
Question 3 - Please confirm - Setting UseNaggle:=false will not help?
Question 4 - Please confirm - Setting that ReuseSocket:=rsTrue will not help?
ASKER
I am trying to get an answer on whether we should use writebuffer???
Now, I have been thinking that maybe we introduced the use of writebuffer to avoid hanging.
For example the client is expecting to receive "Some Data" of a certain size. And if it doesn't get all the data for some reason then the client may just hang. I am not sure about this.
I just need someone to help me that really know what writebuffer is used for.
And MORE IMPORTANTLY when to use it?
In response to Sinsav, for now I just want to understand INDY (can look at alternatives later). I agree UseNaggle should work. I agree that ReuseSocket=rsTrue sounds like a bad idea.
Now, I have been thinking that maybe we introduced the use of writebuffer to avoid hanging.
For example the client is expecting to receive "Some Data" of a certain size. And if it doesn't get all the data for some reason then the client may just hang. I am not sure about this.
I just need someone to help me that really know what writebuffer is used for.
And MORE IMPORTANTLY when to use it?
In response to Sinsav, for now I just want to understand INDY (can look at alternatives later). I agree UseNaggle should work. I agree that ReuseSocket=rsTrue sounds like a bad idea.
ASKER
Well I am testing it now without using the WriteBuffer AND I set UseNaggle=false (for good measure). It is working now. But the real test will be when they have a few users doing other things on their 256 kbps internet.
I will post the results in a few days.
Still it would be nice to get some official wisdom on the use of WriteBuffer.
I will post the results in a few days.
Still it would be nice to get some official wisdom on the use of WriteBuffer.
ASKER
OK, My program works a lot better without WriteBuffer. It is much more stable.
But if I rush the program, ie try to do a few commands quickly it occasionally stuffs up the connection - giving what appears to be packet loss. But it could just be that my customer has the world's worst internet (seriously - it is bad).
Although I can't get it to bug out now - so can't get exact error message.
But if I rush the program, ie try to do a few commands quickly it occasionally stuffs up the connection - giving what appears to be packet loss. But it could just be that my customer has the world's worst internet (seriously - it is bad).
Although I can't get it to bug out now - so can't get exact error message.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No other reasons can explain the question
ICS a lot. From start it is dificult (sync versus async). Synapse is another good component. Some users records problems with Indy:
http://stackoverflow.com/q
UseNaggle should work ...
http://stackoverflow.com/q
http://stackoverflow.com/q
Beacuse socket leaves more time then connection itself ReuseSocket can help when you use a lot of Open - Send - Close sequences to same address, but I suggest to do no use ReuseSocket:=rsTrue