public void ReadCallback(IAsyncResult ar)
{
StateObject state = (StateObject)ar.AsyncState;
Socket clientSocket = state.workSocket;
int bytesRead = clientSocket.EndReceive(ar);
if(bytesRead>0)
{
String str=Encoding.Unicode.GetBytes(state.buffer,0,bytesRead);
textBox1.AppendText("客户端对说:"+str+"\r\n");
}
clientSocket.BeginReceive(state.buffer,0,StateObject.BufferSize,0,new AsyncCallback(ReadCallback),state);
}错误 1 与“System.Text.Encoding.GetBytes(char[], int, int)”最匹配的重载方法具有一些无效参数 D:\c#\pp\pp\Form1.cs 54 28 pp
String str=Encoding.Unicode.GetString(state.buffer,0,bytesRead);