You still do not need to allocate a buffer, since all you need is a pointer to a single character. Hmmm! I should have noted that recv(server,...) was a typo, since that was a typo, then shutdown(server...) is also a typo. I looked up the functions used and here is what your code will do once the typos are fix: FIRST TIME TRU LOOP: 1) Read 1 byte from the socket and then ignore it. 2) START INFINITE LOOP { 3) Open a file. 4) While( there is a byte received OR a SOCKET_ERROR ) { 5) copy byte to file. // before checking if error occured 6) if( error ) break; } 7) Shut down socket so you can no longer send or receive and data. (This means recv(...) will now always return SOCKET_ERROR) 8) Close file. 9) } // END OF INFINITE LOOP AFTER FIRST LOOP: 1) START INFINITE LOOP { 2) Open file. 3) While( SOCKET_ERROR ) { // because of shutdown above 4) Write the last character received (during first loop). 5) Break out of loop (since it was a SOCKER_ERROR). } 6) Try to shut down again (cann't because it was already done). 7) Close file. 8) } // END OF INFINITE LOOP I do not think that was what you were trying to do, but that is what should be happening. There is also the fact that the INFINITE LOOP cann't be stoped properly (any other way if bad). INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen