Click here to Skip to main content
15,915,867 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: member function don't pass to class!!!??? Pin
Richard MacCutchan27-Nov-10 2:53
mveRichard MacCutchan27-Nov-10 2:53 
QuestionHoa can find sound play by MCIWndPlay is end now? Pin
Le@rner26-Nov-10 21:03
Le@rner26-Nov-10 21:03 
AnswerRe: Hoa can find sound play by MCIWndPlay is end now? Pin
Richard MacCutchan27-Nov-10 1:33
mveRichard MacCutchan27-Nov-10 1:33 
QuestionHow can I load put a swf in resources and how to load it Pin
rahul.kulshreshtha26-Nov-10 19:55
rahul.kulshreshtha26-Nov-10 19:55 
AnswerRe: How can I load put a swf in resources and how to load it Pin
Richard MacCutchan26-Nov-10 22:50
mveRichard MacCutchan26-Nov-10 22:50 
GeneralRe: How can I load put a swf in resources and how to load it Pin
rahul.kulshreshtha27-Nov-10 2:02
rahul.kulshreshtha27-Nov-10 2:02 
GeneralRe: How can I load put a swf in resources and how to load it Pin
rahul.kulshreshtha28-Nov-10 22:10
rahul.kulshreshtha28-Nov-10 22:10 
GeneralRe: How can I load put a swf in resources and how to load it Pin
Richard MacCutchan29-Nov-10 3:27
mveRichard MacCutchan29-Nov-10 3:27 
Question[Solved]My CAsyncSocket class doesn't receive data after some secondes. [modified] Pin
stephen_young26-Nov-10 18:16
stephen_young26-Nov-10 18:16 
GeneralRe: My CAsyncSocket class doesn't receive data after some secondes. Pin
Randor 28-Nov-10 5:57
professional Randor 28-Nov-10 5:57 
GeneralRe: My CAsyncSocket class doesn't receive data after some secondes. Pin
stephen_young28-Nov-10 17:02
stephen_young28-Nov-10 17:02 
AnswerRe: [Solved]My CAsyncSocket class doesn't receive data after some secondes. Pin
stephen_young5-Dec-10 17:39
stephen_young5-Dec-10 17:39 
Questionfatal error LNK1104: can not open file .lib Pin
AmbiguousName26-Nov-10 6:26
AmbiguousName26-Nov-10 6:26 
AnswerRe: fatal error LNK1104: can not open file .lib Pin
Richard MacCutchan26-Nov-10 6:32
mveRichard MacCutchan26-Nov-10 6:32 
GeneralRe: fatal error LNK1104: can not open file .lib Pin
AmbiguousName26-Nov-10 6:47
AmbiguousName26-Nov-10 6:47 
GeneralRe: fatal error LNK1104: can not open file .lib Pin
Richard MacCutchan26-Nov-10 7:14
mveRichard MacCutchan26-Nov-10 7:14 
QuestionLoading a CBitmap directly from file system without requiring ::LoadBitmap Pin
Ahmed Charfeddine26-Nov-10 5:04
Ahmed Charfeddine26-Nov-10 5:04 
AnswerRe: Loading a CBitmap directly from file system without requiring ::LoadBitmap Pin
Richard MacCutchan26-Nov-10 6:29
mveRichard MacCutchan26-Nov-10 6:29 
AnswerRe: Loading a CBitmap directly from file system without requiring ::LoadBitmap Pin
Ahmed Charfeddine26-Nov-10 6:45
Ahmed Charfeddine26-Nov-10 6:45 
Questionnot recv()'ing everything [modified] Pin
ALLERSLIT26-Nov-10 4:40
ALLERSLIT26-Nov-10 4:40 
AnswerRe: not recv()'ing everything Pin
Ahmed Charfeddine26-Nov-10 5:37
Ahmed Charfeddine26-Nov-10 5:37 
Please try to correct the "code block" so readers can understand.

You supplied a buffer length that good enough.
However you should note that the socket :recv API does not garantee to you the receipt of all incoming data at once.

You must loop on that function untill either the peer server closes the connection (I think you will get a -1 return value from recv)
or until you know that you received what you "want" ( can only be done if you decode and interpret data at same time ).


Let me suppose that you are talking to a peer webserver, so we know that when all data is sent, the server immediately closes the connection. In that case, your code
should be like this :
char buffer[4096];
int offset = 0;
while ( true )
{
int i = recv(sock, buffer+offset, sizeof(buffer)-offset, 0);
if(i != -1){
offset += i; // increment your offset, so the next chunk of data will be appended to the previously received chunk and not overwrite it
else
break;
}


It is the same thing with the ::send API. You can not garantee that all passed data will be sent. In both cases the system will give you the count of what it managed to process.

Of course you can help avoid these complexities but just using an existing library.

Hope this helps.
Push Framework - now released !
http://www.pushframework.com

GeneralRe: not recv()'ing everything [modified] Pin
ALLERSLIT26-Nov-10 5:57
ALLERSLIT26-Nov-10 5:57 
GeneralRe: not recv()'ing everything Pin
Ahmed Charfeddine26-Nov-10 6:40
Ahmed Charfeddine26-Nov-10 6:40 
AnswerRe: not recv()'ing everything Pin
Richard MacCutchan26-Nov-10 6:20
mveRichard MacCutchan26-Nov-10 6:20 
QuestionHow to detect if the containing popup window is deactivated? Pin
Code-o-mat26-Nov-10 4:32
Code-o-mat26-Nov-10 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.