Once you grab the data from the socket in the byte array use the FileStream class to write the data to a file. The pseudo code would be:
Socket s = new Socket (...);
//Create the file.
FileStream fs = File.Create(path);
byte[ ] bytes = new byte[1024];
int bytesRead = s.Read(bytes, ...); while (bytesRead != 0){
// write the data received from the socket to the file
fs.Write(...); bytesRead = s.Read(bytes, ...);
}
|