/** Creates a connection stub and binds it, use {@link #connect(Address)} to connect */ public TcpConnection(Address peer_addr, TcpBaseServer server) throws Exception { this.server=server; if(peer_addr == null) throw new IllegalArgumentException("Invalid parameter peer_addr="+ peer_addr); this.peer_addr=peer_addr; this.sock=server.socketFactory().createSocket("jgroups.tcp.sock"); setSocketParameters(sock); last_access=getTimestamp(); // last time a message was sent or received (ns) }
public TcpConnection(Socket s, TcpServer server) throws Exception { this.sock=s; this.server=server; if(s == null) throw new IllegalArgumentException("Invalid parameter s=" + s); setSocketParameters(s); this.out=new DataOutputStream(createBufferedOutputStream(s.getOutputStream())); this.in=new DataInputStream(createBufferedInputStream(s.getInputStream())); this.connected=sock.isConnected(); this.peer_addr=server.usePeerConnections()? readPeerAddress(s) : new IpAddress((InetSocketAddress)s.getRemoteSocketAddress()); last_access=getTimestamp(); // last time a message was sent or received (ns) }
public TcpConnection(Socket s, TcpServer server) throws Exception { this.sock=s; this.server=server; if(s == null) throw new IllegalArgumentException("Invalid parameter s=" + s); setSocketParameters(s); this.out=new DataOutputStream(createBufferedOutputStream(s.getOutputStream())); this.in=new DataInputStream(createBufferedInputStream(s.getInputStream())); this.connected=sock.isConnected(); this.peer_addr=server.usePeerConnections()? readPeerAddress(s) : new IpAddress((InetSocketAddress)s.getRemoteSocketAddress()); last_access=getTimestamp(); // last time a message was sent or received (ns) }
/** Creates a connection stub and binds it, use {@link #connect(Address)} to connect */ public TcpConnection(Address peer_addr, TcpBaseServer server) throws Exception { this.server=server; if(peer_addr == null) throw new IllegalArgumentException("Invalid parameter peer_addr="+ peer_addr); this.peer_addr=peer_addr; this.sock=server.socketFactory().createSocket("jgroups.tcp.sock"); setSocketParameters(sock); last_access=getTimestamp(); // last time a message was sent or received (ns) }