Code example for SocketChannel

Methods: socket, write

		// See if we have any backlog that needs to be sent first 
		if (_write()) { 
			// Write the ByteBuffer to the socket 
		// If we didn't get it all sent, add it to the buffer of buffers 
		if (b.remaining() > 0) {
			if (!this.bufferQueue.offer(b)) {
				throw new IOException("Buffers are full, message could not be sent to"
						+ this.socketChannel.socket().getRemoteSocketAddress());
			return false; 
		return true; 
	// actual connection logic 
	private void _connect() throws IOException {