473,379 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

socket listner to recieve file...

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
0 1048

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Gabriele Farina | last post by:
Hi, I'd like to manage multiple socket connection without having to use Threads. I'd like to manage every connection when it is returned from socket_Accept(), without having to wait for the...
1
by: Daniel | last post by:
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" what am i doing wrong? is there some thing else i need to do to free up the socket...
5
by: Chris Spencer | last post by:
I've written a simple class to manage P2P socket connections. However, whenever I try to receive data, the socket raises an exception with the error message (11, 'Resource temporarily...
4
by: zelzel.zsu | last post by:
I wrote two simple socket program. one for sending a file and the other for receiving the file. but when I run it, a curious thing happened. The received file was samller that the sent file. $...
3
by: Adam Clauss | last post by:
There seems to be various methods to determine when the remote client disconnects, but all of them I have seen are Synchronous. AKA: Right before you try to send or receive data, check. Is there...
0
by: Tony Caduto | last post by:
Hi, I am developing a socket server in C# and I want it to be blocking. Anyway I have it working with threads, as each client connects the socket spawned from the accept method is sent to a client...
2
by: Ben | last post by:
I need to send data from a client to a server. In the server code I have: s = ServerSocket.Accept() If (s.Connected = False) Then MsgBox("Unable to connect", , "Server Error") Exit Sub End...
0
by: oferns | last post by:
Hi, apologies for the cluncky title.... Using WinXpSP2 & VS2005 Express editions..... I am writing an asynchronous socket client and I am getting a SocketException error on creating the...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.