public static void send(String host, int port, InputStream ins, OutputStream ops, int timeout) {
        Socket socket = null;
        try {
            socket = new Socket();
            socket.connect(new InetSocketAddress(host, port), timeout);
            // 发送关闭命令
            OutputStream sOut = socket.getOutputStream();
            Streams.write(sOut, ins);
            sOut.flush();

            // 接收服务器的反馈
            if (!socket.isClosed()) {
                InputStream sReturn = socket.getInputStream();
                Streams.write(ops, sReturn);
            }
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
        finally {
            Streams.safeClose(ins);
            Streams.safeClose(ops);
            safeClose(socket);
        }
    }
public static void send(String host, int port, InputStream ins, OutputStream ops, int timeout) {
        Socket socket = null;
        try {
            socket = new Socket();
            socket.connect(new InetSocketAddress(host, port), timeout);
            
            OutputStream sOut = socket.getOutputStream();
            Streams.write(sOut, ins);
            sOut.flush();

            
            if (!socket.isClosed()) {
                InputStream sReturn = socket.getInputStream();
                Streams.write(ops, sReturn);
            }
        }
        catch (IOException e) {
            throw Lang.wrapThrow(e);
        }
        finally {
            Streams.safeClose(ins);
            Streams.safeClose(ops);
            safeClose(socket);
        }
    }
public static void send ( String host , int port , InputStream ins , OutputStream ops , int timeout ) { Socket socket = null ; try { socket = new Socket ( ) ; socket . connect ( new InetSocketAddress ( host , port ) , timeout ) ; // 发送关闭命令 OutputStream sOut = socket . getOutputStream ( ) ; Streams . write ( sOut , ins ) ; sOut . flush ( ) ; // 接收服务器的反馈 if ( ! socket . isClosed ( ) ) { InputStream sReturn = socket . getInputStream ( ) ; Streams . write ( ops , sReturn ) ; } } catch ( IOException e ) { throw Lang . wrapThrow ( e ) ; } finally { Streams . safeClose ( ins ) ; Streams . safeClose ( ops ) ; safeClose ( socket ) ; } }
向某主机发送一些字节内容，并将返回写入输出流

@param host
主机
@param port
端口
@param ins
发送的内容
@param ops
主机返回的输入流
向某主机发送一些字节内容，并将返回写入输出流