 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Niyazi Unugur Guest
|
Posted: Wed Dec 22, 2004 10:03 pm Post subject: what happens if i don't use WaitForData ! |
|
|
i've read many suggestions on the usage of WaitForData (TWinSocketStream) before reading from thread blocking
sockets.
i am developing a realtime system which accepts connections from terminals over GPRS.
On my lab tests, terminals are part of LAN (not over GPRS) and connects to server simultaneously. For each connection, my
server application creates new thead and accepts the connection (by using TServerClientThread). I test 60 - 80 concurrent connections.
Each terminal sends files, receive configuraiton files, do time sync etc. During the tests my server application do not log any exceptions.
The problem arises on the field test when the communication is over GPRS (latency, timeouts, unexpectedly terminating connections, etc). My server
application starts to give unexpected access violations, abnormal program terminations in not more than 2 minutes of up time.
I was shocked !
I enable code-guard, use debug libraries and all my internal debug messages. In my log files i saw strange access violations at some part of my codes and on some parts of VCL codes (system.pas, getmem.inc).
At the end of the third day ! I was discover to use WaitForData in my base socket read function and check disconnections (when WaitForData returns ture, and socket read returns zero byte).
Result is unbelivable, It worked !!!
My question is why i got such unexpected exceptions when not using WaitForData?
Does socket read function overwrite some memory locations, if i use it without WaitForData?
Thanks in advance,
Niyazi Unugur
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Dec 22, 2004 10:59 pm Post subject: Re: what happens if i don't use WaitForData ! |
|
|
"Niyazi Unugur" <unugurn (AT) hotmail (DOT) com> wrote
| Quote: | My question is why i got such unexpected exceptions when
not using WaitForData?
|
You were probably accessing sockets that were no longer valid but ignoring
errors, or accessing buffers that were not available/ready for use.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|