TCP streams and delays
BlitzPlus Forums/BlitzPlus Beginners Area/TCP streams and delays
| ||
The example in the docs under TCP commands uses Delay(2000) after ReadString(). Is this 2 sec delay really necessary? Tests with local computer worked fine without the delay. |
| ||
arctic fox.... Its been over a week and nobody has answered your question, why? Well, it might help if you explain your question properly and refer to the exact example that you mean. |
| ||
I refer to the example used for TCP commands in the documentation / manual. Here's the relevant part of the example:While Not KeyHit(1) strStream=AcceptTCPStream(svrGame) If strStream Then Print ReadString$(strStream) Delay 2000 End Else Print "No word from Apollo X yet ..." Delay 1000 End If Wend As you can see, it has a Delay 2000 after ReadString$. Is this delay necessary? Does ReadString$ require a short delay so that it has time to process all the incoming data? Is there some specific reason why the delay command is used in the example? Thanks for your productive suggestions and input, Prof! |
| ||
The delay is not necessary. It may be useful between two ReadAvail or AcceptTCPStream commands, but anyway, you would need a very short delay, which is usually performed by the programming loop itself. So, to answer your question, in the code you posted that delay could be substituted with a small one, or completely removed. Bare in mind that in case you remove it, the screen will be suddenly fill with text that comes from the loop - that's why that delay is there. Experiment yourself. Is the best way to get an answer sometime.. ;-) Sergio. |