public class SocketPeerConnection extends Object implements PeerConnection
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeQuietly()
Close the connection without throwing an
IOException . |
long |
getLastActive() |
Peer |
getRemotePeer() |
int |
getRemotePort() |
TorrentId |
getTorrentId() |
boolean |
isClosed() |
void |
postMessage(Message message)
Send a message to remote peer.
|
Message |
readMessage(long timeout)
Attempt to read an incoming message within a specified time interval.
|
Message |
readMessageNow()
Attempt to read an incoming message.
|
TorrentId |
setTorrentId(TorrentId torrentId)
Associate this connection with the given torrent ID.
|
String |
toString() |
public TorrentId setTorrentId(TorrentId torrentId)
PeerConnection
setTorrentId
in interface PeerConnection
torrentId
- Torrent ID to associate this connection withpublic TorrentId getTorrentId()
getTorrentId
in interface PeerConnection
public Message readMessageNow() throws IOException
PeerConnection
readMessageNow
in interface PeerConnection
IOException
public Message readMessage(long timeout) throws IOException
PeerConnection
readMessage
in interface PeerConnection
IOException
public void postMessage(Message message)
PeerConnection
postMessage
in interface PeerConnection
public Peer getRemotePeer()
getRemotePeer
in interface PeerConnection
public int getRemotePort()
getRemotePort
in interface PeerConnection
public void closeQuietly()
PeerConnection
IOException
.closeQuietly
in interface PeerConnection
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isClosed()
isClosed
in interface PeerConnection
public long getLastActive()
getLastActive
in interface PeerConnection
Copyright © 2016–2021. All rights reserved.