c# Socket实例_中文字符

voneloo 23 0 ZIP 2019-06-23 12:06:33

c# Socket instance_Chinese characters

用户评论
请输入评论内容
评分:
Generic placeholder image 卡了网匿名网友 2019-06-23 12:06:33

非常有用,谢谢分享!

Generic placeholder image 卡了网匿名网友 2019-06-23 12:06:33

很简洁,能看懂对我很有用。总结一下 Encoding myEncoding = Encoding.GetEncoding("GB2312"); //发送用户 byte[] msg = myEncoding.GetBytes(userName); clientSocket.Send(msg); //获得返回消息 byte[] res = new byte[255]; int by1 = clientSocket.Receive(res); string recvStr = myEncoding.GetString(res, 0, by1);