Re: ASyncSocket Receive Problem
Thank you Mr Mike,
I dint called more than once Receive() in OnReceive().
One small information who is calling the OnReceive()?
1.System commands
2.Socket event.
What is the behind story of AsyncSocket,OnReceive() and Receive() methods?
Thanks,
Bharath.
Re: ASyncSocket Receive Problem
Re: ASyncSocket Receive Problem
Quote:
Originally Posted by
VictorN
I studied that articals. Even though i didn't find my problem.
Re: ASyncSocket Receive Problem
Have you verified server operation by using a protocol analyser like WireShark?
Re: ASyncSocket Receive Problem
Quote:
Originally Posted by
bharathkumarreddy.s
... I dint called more than once Receive() in OnReceive().
Then why is it that you stated that you "maintain[ed] in loop" "if coming data is greater than 4096"?
Never mind, please don't bother to answer.
Please show your code for send and receive, as mentioned by VictorN above.
Quote:
One small information who is calling the OnReceive()?
1.System commands
2.Socket event.
What is the behind story of AsyncSocket,OnReceive() and Receive() methods?
The details are complex, but the basic idea is this: When there is a new socket event (such as the arrival of new data in the incoming buffer), Windows converts the event into an ordinary Windows message which it posts to the application's message queue. In the MFC message loop, when it encounters one of these messages, the MFC framework converts it into a call to the appropriate virtual function, such as a call to your implementation of the virtual OnReceive() function.
These details are explained in the links that VictorN gave you.
Mike
Re: ASyncSocket Receive Problem
Quote:
Originally Posted by
MikeAThon
You should never call Receive() more than once in a single OnReceive() handler. It's incorrect to call Receive() in a loop. Call Receive() exactly once. According to the Winsock and CAsyncSocket framework, if more data is available in the buffer after the call to Receive(), the framework will generate another call to OnReceive at some indeterminate time in the future. The remainder of the buffer can be obtained in the second call to OnReceive (or at least some more of the buffer can be drained).
Mike
PS: And VictorN is correct: it's hard to diagnose further without seeing your code for both sender and receiver.
Thank you.
Re: ASyncSocket Receive Problem
Quote:
Originally Posted by
jeron
Have you verified server operation by using a protocol analyser like WireShark?
Thank you jeron,
I solved my problem. here the problem is java socket outputstream writeBytes();
I just changed this method to write(data.getByteArray());
Thank you for all of you,
special thanks to VictorN.
Re: ASyncSocket Receive Problem
Quote:
Originally Posted by
VictorN
It's hard to say you more without seeing your actual code (for both sender and receiver)
I solved my problem, problem with java socket outputstream WriteBytes().
I solved that with replacing that method with write(data.getByteArray())
Thank you very much mr.VictorN.
Re: ASyncSocket Receive Problem
Re: ASyncSocket Receive Problem
VictorN please help me how to find Application crash?
I wrote another thread regarding that problem,i din't find and reply from more than 5 days.
pls, reply me.
Thanks,
Bharath