|
-
April 29th, 2010, 03:02 AM
#16
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.
-
April 29th, 2010, 03:06 AM
#17
Re: ASyncSocket Receive Problem
Victor Nijegorodov
-
April 29th, 2010, 04:32 AM
#18
Re: ASyncSocket Receive Problem
 Originally Posted by VictorN
I studied that articals. Even though i didn't find my problem.
-
April 29th, 2010, 12:27 PM
#19
Re: ASyncSocket Receive Problem
Have you verified server operation by using a protocol analyser like WireShark?
-
April 29th, 2010, 12:42 PM
#20
Re: ASyncSocket Receive Problem
 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.
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
Last edited by MikeAThon; April 29th, 2010 at 01:28 PM.
-
April 29th, 2010, 11:16 PM
#21
Re: ASyncSocket Receive Problem
 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.
-
May 5th, 2010, 12:09 AM
#22
Re: ASyncSocket Receive Problem
 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.
-
May 5th, 2010, 12:13 AM
#23
Re: ASyncSocket Receive Problem
 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.
-
May 5th, 2010, 01:00 AM
#24
Re: ASyncSocket Receive Problem
You are welcome!
Victor Nijegorodov
-
May 5th, 2010, 02:37 AM
#25
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|