Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
           ofd.ShowDialog();
           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.10.3.137", 10);
         NetworkStream nw = socket.GetStream();
        nw.Write(buffer, 0, buffer.Length);
        nw.Close();
        } 
        }
    }
Posted 27-Dec-12 5:05am
Edited 28-Dec-12 2:14am
ridoy50.5K
v4
Comments
aspnet_regiis -i at 27-Dec-12 11:11am
   
What do you mean by client PC? Are they connected by LAN or VPN ?
fahimmahbub at 27-Dec-12 13:11pm
   
yes they connected by LAN
fahimmahbub at 27-Dec-12 14:02pm
   
actually i mean client pc means other pc
fahimmahbub at 27-Dec-12 14:00pm
   
please give me another solution
ridoy at 27-Dec-12 15:01pm
   
do you prefer bluetooth connection?
fahimmahbub at 28-Dec-12 6:59am
   
no
Sergey Alexandrovich Kryukov at 27-Dec-12 22:45pm
   
What do you mean by "without server", exactly? What server? Any? —SA
fahimmahbub at 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 at 28-Dec-12 12:39pm
   
I answered, see also my last comment... —SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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. —SA
fahimmahbub at 28-Dec-12 8:03am
   
my problem is how to receive file from clients and save file on server
Rate this: bad
good
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?" Smile | :)
 
—SA
  Permalink  
Comments
aspnet_regiis -i at 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. :)
Sergey Alexandrovich Kryukov at 28-Dec-12 2:44am
   
You are right; in a way, it will work even if the second PC is not available. It will be deferred transfer! —SA
fahimmahbub at 28-Dec-12 8:05am
   
my problem is how to receive file from clients and save file on server
Sergey Alexandrovich Kryukov at 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... —SA

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 435
1 OriginalGriff 427
2 Manas Bhardwaj 348
3 Damith Weerasinghe 330
4 Tadit Dash 290
0 Sergey Alexandrovich Kryukov 9,625
1 OriginalGriff 6,065
2 Peter Leow 4,500
3 Maciej Los 3,565
4 Abhinav S 3,513


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid