public void setReceiveTimeout(TcpSocket fan, Duration v) { try { if (v == null) socket.setSoTimeout(0); else socket.setSoTimeout((int) (v.millis())); } catch (IOException e) { throw IOErr.make(e); } }
public TcpSocket connect(TcpSocket fan, IpAddr addr, long port, Duration timeout) { try { // connect int javaTimeout = (timeout == null) ? 0 : (int) timeout.millis(); socket.connect(new InetSocketAddress(addr.peer.java, (int) port), javaTimeout); connected(fan); return fan; } catch (IOException e) { throw IOErr.make(e); } }