By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,894 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,894 IT Pros & Developers. It's quick & easy.

socket listner to recieve file...

P: n/a
Hi all,

I have a client that send a text file to a server... the client end
seems to work ok. I would like some help on the server side, it's
listening fine... but how do I get it to recieve a file sent to it &
save to a folder?

Client code for sending file... using .NET 1.1 (C#)

Stream fileStream = File.OpenRead(fileToUpload);
// Alocate memory space for the file
byte[] fileBuffer = new byte[fileStream.Length];
fileStream.Read(fileBuffer, 0, (int)fileStream.Length);

// Open a TCP/IP Connection and send the data
TcpClient clientSocket=new TcpClient(ipAddr, 11000);
NetworkStream networkStream = clientSocket.GetStream();
networkStream.Write(fileBuffer,0,fileBuffer.GetLen gth(0));
networkStream.Close();

On the server side I'm just missing the file handling code, it listens
fine.
TIA

Sep 28 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.