[twsocket] Multiple OnDataAvailable calls when no data to read

2008-12-01 Thread Anton Sviridov
Arno Garrels [TeamICS] wrote: Have a look at this demo, if you think it's usefull I can add it to the repository. Oh, I am looking at this and get myself full of questions. Server app is rather clear, but not the Client, it's quite complex. 1) What's the meainng of SendBinString in Server, it

[twsocket] Multiple OnDataAvailable calls when no data to read

2008-12-01 Thread Anton Sviridov
Arno Garrels [TeamICS] wrote: Have a look at this demo, if you think it's usefull I can add it to the repository. Oh, I am looking at this and get myself full of questions. Server app is rather clear, but not the Client, it's quite complex. 1) What's the meainng of SendBinString in Server, it

Re: [twsocket] Multiple OnDataAvailable calls when no data to read

2008-12-01 Thread Arno Garrels
Anton Sviridov wrote: 1) What's the meainng of SendBinString in Server, it is never used? It's never used. What for do you use PutDataInSendBuffer? It puts data into the send buffer without actually sending the data, it's not required, however saves on internal call to socket.send. 2) I

[twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-26 Thread Anton Sviridov
Arno Garrels [TeamICS] wrote: AFAIK no, only if you do not read all available data OnDataAvailable will trigger again. Arno Garrels [TeamICS] wrote: Thus calling Receive multiple times in a loop in on DataAvailable would not work properly. *embarrassed* how these two statements combine? Why

Re: [twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-26 Thread Wilfried Mestdagh
Hello Anton, *embarrassed* how these two statements combine? Why several Receives should cause troubles? it is by design, only 1 receive call in the event. And another question. Is TWSocket.RcvdCount value reliable, i.e. if it = 0, then there is really no data in the socket? Microsoft

[twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-25 Thread Anton Sviridov
I'm now implementing a server on the base of TWSocketServer. In the client app I send some message to the server app, which receives it inside ServerIn_ClientDataAvailable procedure. Receiving is realized step by step to find a signature of message - i.e., there are several client.Receive in

Re: [twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-25 Thread Wilfried Mestdagh
Hello Anton, Don't worry. You don't have to do anything on the 'would block' winsock error. TWSocket deals with it. when OnDataAvailable fires, just try to receive all data. When Receive return 0 or -1 then just exit the event handler. -1 is error (don't worry), and 0 is if the peer has closed.

Re: [twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-25 Thread Arno Garrels
Wilfried Mestdagh wrote: Hello Anton, Don't worry. You don't have to do anything on the 'would block' winsock error. TWSocket deals with it. when OnDataAvailable fires, just try to receive all data. When Receive return 0 or -1 then just exit the event handler. -1 is error (don't

[twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-25 Thread Anton Sviridov
Hello, Wilfried! You have calmed me :) Arno Garrels [TeamICS] wrote: As I understand the OP calls receive multiple times in OnDataAvailable which is not a good idea. So, each Recv launches one more OnDataAvail in the future? If so, can I easily read from socket block-by-block? Here's what i do

Re: [twsocket] Multiple OnDataAvailable calls when no data to read

2008-11-25 Thread Arno Garrels
Anton Sviridov wrote: Hello, Wilfried! You have calmed me :) Arno Garrels [TeamICS] wrote: As I understand the OP calls receive multiple times in OnDataAvailable which is not a good idea. So, each Recv launches one more OnDataAvail in the future? AFAIK no, only if you do not read all