Java Code Examples for com.sun.nio.sctp.MessageInfo#address()
The following examples show how to use
com.sun.nio.sctp.MessageInfo#address() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SctpChannelImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 2
Source File: SctpChannelImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 3
Source File: SctpChannelImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 4
Source File: SctpChannelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 5
Source File: MsgSunNioSctp.java From mts with GNU General Public License v3.0 | 5 votes |
/** * Get a parameter from the message */ //@Override protected Parameter getParameterMsgPeerHost() throws Exception { Parameter var = new Parameter(); if( this.dataSunNioSctp.hasMessageInfo() ){ MessageInfo messageInfo = this.dataSunNioSctp.getMessageInfo(); SocketAddress socketAddress = messageInfo.address(); if( (socketAddress!=null) && (socketAddress instanceof InetSocketAddress) ){ InetSocketAddress inetSocketAddress = (InetSocketAddress)socketAddress; var.add( inetSocketAddress.getHostName() ); } } return var; }
Example 6
Source File: MsgSunNioSctp.java From mts with GNU General Public License v3.0 | 5 votes |
/** * Get a parameter from the message */ //@Override protected Parameter getParameterMsgPeerPort() throws Exception { Parameter var = new Parameter(); if( this.dataSunNioSctp.hasMessageInfo() ){ MessageInfo messageInfo = this.dataSunNioSctp.getMessageInfo(); SocketAddress socketAddress = messageInfo.address(); if( (socketAddress!=null) && (socketAddress instanceof InetSocketAddress) ){ InetSocketAddress inetSocketAddress = (InetSocketAddress)socketAddress; var.add( inetSocketAddress.getPort() ); } } return var; }
Example 7
Source File: SctpChannelImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 8
Source File: SctpChannelImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 9
Source File: SctpChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 10
Source File: SctpChannelImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 11
Source File: SctpChannelImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 12
Source File: SctpChannelImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 13
Source File: SctpChannelImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 14
Source File: SctpChannelImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }
Example 15
Source File: SctpChannelImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private int send(int fd, ByteBuffer src, MessageInfo messageInfo) throws IOException { int streamNumber = messageInfo.streamNumber(); SocketAddress target = messageInfo.address(); boolean unordered = messageInfo.isUnordered(); int ppid = messageInfo.payloadProtocolID(); if (src instanceof DirectBuffer) return sendFromNativeBuffer(fd, src, target, streamNumber, unordered, ppid); /* Substitute a native buffer */ int pos = src.position(); int lim = src.limit(); assert (pos <= lim && streamNumber >= 0); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer bb = Util.getTemporaryDirectBuffer(rem); try { bb.put(src); bb.flip(); /* Do not update src until we see how many bytes were written */ src.position(pos); int n = sendFromNativeBuffer(fd, bb, target, streamNumber, unordered, ppid); if (n > 0) { /* now update src */ src.position(pos + n); } return n; } finally { Util.releaseTemporaryDirectBuffer(bb); } }