Click here to Skip to main content
15,894,630 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: How to detect if the containing popup window is deactivated? Pin
Ahmed Charfeddine26-Nov-10 5:22
Ahmed Charfeddine26-Nov-10 5:22 
GeneralRe: How to detect if the containing popup window is deactivated? Pin
Code-o-mat26-Nov-10 5:30
Code-o-mat26-Nov-10 5:30 
GeneralRe: How to detect if the containing popup window is deactivated? Pin
Ahmed Charfeddine26-Nov-10 5:47
Ahmed Charfeddine26-Nov-10 5:47 
GeneralRe: How to detect if the containing popup window is deactivated? Pin
Code-o-mat26-Nov-10 6:04
Code-o-mat26-Nov-10 6:04 
QuestionLPSTR or something like that Pin
Krauze26-Nov-10 3:49
Krauze26-Nov-10 3:49 
AnswerRe: LPSTR or something like that Pin
Ahmed Charfeddine26-Nov-10 5:14
Ahmed Charfeddine26-Nov-10 5:14 
GeneralRe: LPSTR or something like that Pin
Krauze26-Nov-10 14:32
Krauze26-Nov-10 14:32 
AnswerRe: LPSTR or something like that Pin
Chris Losinger26-Nov-10 5:15
professionalChris Losinger26-Nov-10 5:15 
GeneralRe: LPSTR or something like that Pin
Krauze26-Nov-10 14:33
Krauze26-Nov-10 14:33 
AnswerRe: LPSTR or something like that Pin
yu-jian26-Nov-10 6:19
yu-jian26-Nov-10 6:19 
GeneralRe: LPSTR or something like that Pin
Krauze26-Nov-10 14:33
Krauze26-Nov-10 14:33 
GeneralRe: LPSTR or something like that Pin
yu-jian28-Nov-10 4:08
yu-jian28-Nov-10 4:08 
QuestionBlack out the application. Pin
Le@rner26-Nov-10 1:07
Le@rner26-Nov-10 1:07 

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.