diff options
author | Ugnich Anton | 2013-09-07 19:54:51 +0700 |
---|---|---|
committer | Ugnich Anton | 2013-09-07 19:54:51 +0700 |
commit | b86eb130ef8a1b06a34454a47738e0a8ba9b50dd (patch) | |
tree | 644cd1e9df062f9b520dc2dee316af666ca4282a /src/com/juick/jabber/ws/SocketSubscribed.java | |
parent | 265e629e5bc5ad8f9d2a8e94dce864ebe995bcef (diff) |
XMPPConnection.buildTextFrame; SocketSubscribed.sendByteBuffer, close
Diffstat (limited to 'src/com/juick/jabber/ws/SocketSubscribed.java')
-rw-r--r-- | src/com/juick/jabber/ws/SocketSubscribed.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/juick/jabber/ws/SocketSubscribed.java b/src/com/juick/jabber/ws/SocketSubscribed.java index f865ce6a..6144380c 100644 --- a/src/com/juick/jabber/ws/SocketSubscribed.java +++ b/src/com/juick/jabber/ws/SocketSubscribed.java @@ -1,5 +1,6 @@ package com.juick.jabber.ws; +import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; /** @@ -24,4 +25,27 @@ public class SocketSubscribed { this.VUID = VUID; tsConnected = tsLastData = System.currentTimeMillis(); } + + public boolean sendByteBuffer(ByteBuffer bb) { + boolean ret = false; + bb.rewind(); + try { + sock.write(bb); + ret = true; + } catch (Exception e) { + close(); + } + return ret; + } + + public void close() { + try { + sock.socket().close(); + } catch (Exception e) { + } + try { + sock.close(); + } catch (Exception e) { + } + } } |