C#:从客户端的两个(2)文件向服务器发送数据(txt)

时间:2018-12-12 13:25:16

标签: c# client-server

, 这是我的一个(1).txt文件的代码:  从客户端

string ip = "localhost";
    int port = 8080;
        string temperature = File.ReadAllText(@"C:\Users\Public\Documents\Hardware Config.txt");

        TcpClient client = new TcpClient(ip, port);

        int byteCount2 = Encoding.ASCII.GetByteCount(temperature);

        byte[] sendData2 = new byte[byteCount2];

        sendData2 = Encoding.ASCII.GetBytes(temperature);

        NetworkStream stream = client.GetStream();

        stream.Write(sendData2, 0, sendData2.Length);

        stream.Close();
        client.Close();

但是我想发送两个.txt文件,

string temperature = File.ReadAllText(@"C:\Users\Public\Documents\Hardware Config.txt");

string app = File.ReadAllText(@"C:\Users\Public\Documents\Application.txt");

0 个答案:

没有答案