摘要:
1、tcpserver1 ServerSocket svs(6000);//绑定端口开始监听2 TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);3 srv.start();2、tcpclient1 SocketAddress sa("localhost", svs.address().port());2 StreamSocket ss1(sa);3 ss1.sendBytes("hello", 5);4 cha... 阅读全文
摘要:
1、udpserver1 UDPEchoServer echoserver(SocketAddress("localhost",6000));2 echoserver.run();2、udpclient1 UDPEchoServer echoServer;2 DatagramSocket ss;3 ss.connect(SocketAddress("localhost", echoServer.port()));//连接4 int n = ss.sendBytes("hello", 5);//发送5 ... 阅读全文