110,534
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
ServerSocket server=new ServerSocket(5678);
Socket client=server.accept();
byte[] b="关".getBytes("utf8");
client.getOutputStream().write(b);
// byte[] b="Hello".getBytes("utf8");
// client.getOutputStream().write(b);
client.close();
}
static void Main(string[] args)
{
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient("localhost", 5678);
byte[] b = new byte[1024];
int i = client.GetStream().Read(b, 0, b.Length);
string s = System.Text.Encoding.UTF8.GetString(b, 0, i);
client.Close();
}
static void Main(string[] args)
{
int i = -27;
byte testbyte = (byte)i;
}