TcpClient client = new TcpClient();
client.Connect("localhost", 8889 );
NetworkStream stream = client.GetStream();
stream.Write( System.Text.Encoding.ASCII.GetBytes("hello");

解决方案 »

  1.   

    sun926(初学者)大侠,错误啊,提示说:
    D:\tcptest\Form1.cs(159): 重载“Write”方法未获取“1”参数
      

  2.   

    stream.Write( System.Text.Encoding.ASCII.GetBytes("hello"));
    结尾少个括号
      

  3.   

    TcpClient client = new TcpClient();
    client.Connect("localhost", 8889 );
    NetworkStream stream = client.GetStream();
    stream.Write( System.Text.Encoding.ASCII.GetBytes("hello"));
      

  4.   

    括号我早就添上了,添上之后说重载“Write”方法未获取“1”参数
      

  5.   

    TcpClient client = new TcpClient();
    client.Connect("localhost", 8889 );
    NetworkStream stream = client.GetStream();
    byte[] buf = System.Text.Encoding.ASCII.GetBytes("hello");
    stream.Write( buf, 0, buf.Length );