byte[] buffer=tf.getText().getBytes();//tf是一个文本框控件
try {
OutputStream out = socket.getOutputStream();
out.write(buffer, 0, buffer.length);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
..............................java客户端发送部分
byte[] buffer = new byte[BufferSize];
NetworkStream streamToClient = remoteClient.GetStream();
int bytesRead = streamToClient.Read(buffer, 0, BufferSize);
string msg = Encoding.Unicode.GetString(buffer, 0, bytesRead);
TextBox1.Text=msg;
...........................................C#接收部分
请问是不是应该在string msg = Encoding.Unicode.GetString(buffer, 0, bytesRead);这句话上做些修改就行了