Hello mates:
I met problem with using read() & write(). I m trying to use read twice on client first time is the size of buffer, 2nd time is the buffer. I think I have to, coz I dnot know file size. So, I write twice on server as well -- 1st, filesize; 2nd, buffer.
The problem is, sometimes, I cannot get anything at 2nd time. The file I got is empty, nothing. However, if I put a sleep(1) before the 2nd write() on server, I can read( but this sometimes may cause a segmentation fault)...
i.e.:
Client Server
read\(\) 1st write\(\) 1st <-----both OK
\(if I put a sleep\(1\)here, it's OK\)
read\(\) 2d write\(\) 2nd <-----problem
Does anybody know the reason?
BEST REGARDS,
Elton