hello forum,
i am somehow stuck with a beginner networking problem. i generally do not know how to read/recv all data to process it. for instance, taking this example:
now, if i would replace the strncat line withCode:file = open("test.txt",O_RDONLY); while(read(file,buf,1)>=0){ strncat(store,buf,1); }
the while loop finishes and the program ends like it should. with the strncat in place it reads the file but is somehow stuck in the while loop. i wonder what i do wrong there.Code:send(client,buf,1,0);
possibly i have generally a wrong way of trying to read a buffer with recv/read wrong, possibly somebody can show me what the correct way is to read/send a full buffer. lets say
i have a defined buffer of 1024 bytes but the file is 4094 big.
thank for your answers,
fc



LinkBack URL
About LinkBacks


