@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override public InputStream getInputStream() throws IOException { checkOpenAndConnected(); if (isInputShutdown()) { throw new SocketException("Socket input is shutdown"); } return new SocketChannelInputStream(channel); }
@Override public void connect(SocketAddress remoteAddr, int timeout) throws IOException { if (!channel.isBlocking()) { throw new IllegalBlockingModeException(); } if (isConnected()) { throw new AlreadyConnectedException(); } super.connect(remoteAddr, timeout); channel.initLocalAddressAndPort(); if (super.isConnected()) { channel.setConnected(); channel.isBound = super.isBound(); } }
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
connectAddress = inetSocketAddress; if (socket != null) { socket.socketImpl().initRemoteAddressAndPort(connectAddress.getAddress(), connectAddress.getPort());
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override synchronized public Socket socket() { if (socket == null) { try { InetAddress addr = null; int port = 0; if (connectAddress != null) { addr = connectAddress.getAddress(); port = connectAddress.getPort(); } socket = new SocketAdapter(new PlainSocketImpl(fd, localPort, addr, port), this); } catch (SocketException e) { return null; } } return socket; }
@Override public void connect(SocketAddress remoteAddr, int timeout) throws IOException { if (!channel.isBlocking()) { throw new IllegalBlockingModeException(); } if (isConnected()) { throw new AlreadyConnectedException(); } super.connect(remoteAddr, timeout); channel.initLocalAddressAndPort(); if (super.isConnected()) { channel.setConnected(); channel.isBound = super.isBound(); } }
@Override public void connect(SocketAddress remoteAddr, int timeout) throws IOException { if (!channel.isBlocking()) { throw new IllegalBlockingModeException(); } if (isConnected()) { throw new AlreadyConnectedException(); } super.connect(remoteAddr, timeout); channel.initLocalAddressAndPort(); if (super.isConnected()) { channel.setConnected(); channel.isBound = super.isBound(); } }
@Override public void connect(SocketAddress remoteAddr, int timeout) throws IOException { if (!channel.isBlocking()) { throw new IllegalBlockingModeException(); } if (isConnected()) { throw new AlreadyConnectedException(); } super.connect(remoteAddr, timeout); channel.initLocalAddressAndPort(); if (super.isConnected()) { channel.setConnected(); channel.isBound = super.isBound(); } }
@Override public void connect(SocketAddress remoteAddr, int timeout) throws IOException { if (!channel.isBlocking()) { throw new IllegalBlockingModeException(); } if (isConnected()) { throw new AlreadyConnectedException(); } super.connect(remoteAddr, timeout); channel.initLocalAddressAndPort(); if (super.isConnected()) { channel.setConnected(); channel.isBound = super.isBound(); } }
private void initLocalAddressAndPort() { SocketAddress sa; try { sa = Libcore.os.getsockname(fd); } catch (ErrnoException errnoException) { throw new AssertionError(errnoException); } InetSocketAddress isa = (InetSocketAddress) sa; localAddress = isa.getAddress(); localPort = isa.getPort(); if (socket != null) { socket.socketImpl().initLocalPort(localPort); } }