现在的位置: 首页 > 综合 > 正文

Java网络

2018年04月10日 ⁄ 综合 ⁄ 共 332字 ⁄ 字号 评论关闭
3.2.1 多个客户端


 


3.2.2 半关闭(不发送,仍接收)


Socket socket = new Socket(host,port);


Scanner in = new Scanner(Socket.getInputStream());


PrintWriter writer = new PrintWriter(socket.getOutputStream());


 


3.3 可中断套接字


java.nio包


SocketChannel类:NIO缓存。


SocketChannel channel = SocketChannel.open(new InetSocketAddress(host,port));


Scanner in = new Scanner(channel);


 


3.4 发送Email


 


3.5 建立URL连接

抱歉!评论已关闭.