Ejemplo n.º 1
0
 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);
   }
 }
Ejemplo n.º 2
0
 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);
   }
 }