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)
PeerConnectionsetTorrentId in interface PeerConnectiontorrentId - Torrent ID to associate this connection withpublic TorrentId getTorrentId()
getTorrentId in interface PeerConnectionpublic Message readMessageNow() throws IOException
PeerConnectionreadMessageNow in interface PeerConnectionIOExceptionpublic Message readMessage(long timeout) throws IOException
PeerConnectionreadMessage in interface PeerConnectionIOExceptionpublic void postMessage(Message message)
PeerConnectionpostMessage in interface PeerConnectionpublic Peer getRemotePeer()
getRemotePeer in interface PeerConnectionpublic int getRemotePort()
getRemotePort in interface PeerConnectionpublic void closeQuietly()
PeerConnectionIOException.closeQuietly in interface PeerConnectionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
isClosed in interface PeerConnectionpublic long getLastActive()
getLastActive in interface PeerConnectionCopyright © 2016–2021. All rights reserved.