Click here to Skip to main content
13,453,834 members (41,063 online)
Rate this:
Please Sign up or sign in to vote.
See more:
my problem is how to receive file from clients and save file on server

here is my client code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace client
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            OpenFileDialog ofd = new OpenFileDialog();
           textBox1.Text = ofd.FileName;

        private void button2_Click(object sender, EventArgs e)
            Stream Fs = File.OpenRead(textBox1.Text);
           Byte[] buffer = new Byte[Fs.Length];
         Fs.Read(buffer, 0, buffer.Length);
          TcpClient socket = new TcpClient("", 10);
         NetworkStream nw = socket.GetStream();
        nw.Write(buffer, 0, buffer.Length);
Posted 27-Dec-12 5:05am
Updated 28-Dec-12 2:14am
aspnet_regiis -i 27-Dec-12 11:11am
What do you mean by client PC? Are they connected by LAN or VPN ?
fahimmahbub 27-Dec-12 13:11pm
yes they connected by LAN
fahimmahbub 27-Dec-12 14:02pm
actually i mean client pc means other pc
fahimmahbub 27-Dec-12 14:00pm
please give me another solution
ridoy 27-Dec-12 15:01pm
do you prefer bluetooth connection?
fahimmahbub 28-Dec-12 6:59am
Sergey Alexandrovich Kryukov 27-Dec-12 22:45pm
What do you mean by "without server", exactly? What server? Any?
fahimmahbub 28-Dec-12 7:03am
sorry i mistake the word choose without server
actually i should be written (File transfer from my pc to other pc in c# using lan)
Sergey Alexandrovich Kryukov 28-Dec-12 12:39pm
I answered, see also my last comment...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Sergey Alexandrovich Kryukov 27-Dec-12 22:49pm
Did you pay attention for the words "without server"? :-)
Even though it's not quite clear what OP means by "server", I basically answered — please see.
fahimmahbub 28-Dec-12 8:03am
my problem is how to receive file from clients and save file on server
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Without server? No, if you mean the software server, whatever it is — FTP server, HTTP server, custom network server. Practically, this is the same as to ask "How can I transfer files from one client PC to another client PC, without a second PC?" :-)

aspnet_regiis -i 28-Dec-12 2:38am
I think the best solution for him is to write the files to a DVD and then transfer to another PC. :)
You are right; in a way, it will work even if the second PC is not available. It will be deferred transfer!
fahimmahbub 28-Dec-12 8:05am
my problem is how to receive file from clients and save file on server
Sergey Alexandrovich Kryukov 28-Dec-12 12:38pm
So? It depends on what do you want to run on it. Do you have access to both computers? Will you run any service software or build your own? It could be as simple as file sharing service and can be also FTP, HTTP, custom, or something else...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180318.3 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100