Lines Matching refs:ch

99         try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
100 if (ch.getLocalAddress() != null)
102 ch.bind(new InetSocketAddress(0));
105 InetSocketAddress local = (InetSocketAddress)ch.getLocalAddress();
113 ch.bind(new InetSocketAddress(0));
120 AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
121 ch.close();
123 ch.bind(new InetSocketAddress(0));
132 try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
133 ch.setOption(SO_RCVBUF, 128*1024)
139 before = ch.getOption(SO_SNDBUF);
140 after = ch.setOption(SO_SNDBUF, Integer.MAX_VALUE).getOption(SO_SNDBUF);
143 before = ch.getOption(SO_RCVBUF);
144 after = ch.setOption(SO_RCVBUF, Integer.MAX_VALUE).getOption(SO_RCVBUF);
148 ch.bind(new InetSocketAddress(0));
151 if (ch.getOption(SO_KEEPALIVE))
153 if (ch.getOption(TCP_NODELAY))
157 if (!ch.setOption(SO_KEEPALIVE, true).getOption(SO_KEEPALIVE))
159 if (!ch.setOption(TCP_NODELAY, true).getOption(TCP_NODELAY))
163 ch.getOption(SO_RCVBUF);
164 ch.getOption(SO_SNDBUF);
177 try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
178 ch.connect(address).get();
180 if (ch.getLocalAddress() == null)
184 InetSocketAddress remote = (InetSocketAddress)ch.getRemoteAddress();
192 ch.connect(server.address()).get();
202 AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
203 ch.close();
205 ch.connect(server.address()).get();
212 ch.connect(server.address(), (Void)null, new CompletionHandler<Void,Void>() {
227 try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
229 ch.connect(address).get();
232 if (ch.isOpen())
240 try (AsynchronousSocketChannel ch = AsynchronousSocketChannel.open()) {
242 ch.connect(genSocketAddress()).get();
245 if (ch.isOpen())
255 AsynchronousSocketChannel ch;
258 ch = AsynchronousSocketChannel.open();
259 Future<Void> connectResult = ch.connect(genSocketAddress());
265 ch.close();
279 ch = AsynchronousSocketChannel.open();
280 ch.connect(server.address()).get();
283 Future<Integer> result = ch.read(dst);
288 ch.read(buf);
294 ch.close();
308 ch = AsynchronousSocketChannel.open();
309 ch.connect(server.address()).get();
315 ch.write(genBuffer(), ch, new CompletionHandler<Integer,AsynchronousSocketChannel>() {
316 public void completed(Integer result, AsynchronousSocketChannel ch) {
317 ch.write(genBuffer(), ch, this);
319 public void failed(Throwable x, AsynchronousSocketChannel ch) {
329 ch.write(genBuffer());
335 ch.close();
355 AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
356 ch.connect(server.address()).get();
361 Future<Integer> res = ch.read(buf);
385 ch.write(buf).get();
388 ch.close();
398 final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
399 ch.connect(server.address()).get();
404 int n = ch.read(buf).get();
419 ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
423 ch.read(dst, (Void)null, this);
442 ch.close();
446 ch.read(dst).get();
459 final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
460 ch.connect(server.address()).get();
468 ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
471 ch.read(dst, (Void)null, this);
504 ch.close();
513 final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
514 ch.connect(server.address()).get();
524 ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null,
551 ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null,
564 ch.close();
573 final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
574 ch.connect(server.address()).get();
580 int n = ch.write(buf).get();
586 ch.write(src, (Void)null, new CompletionHandler<Integer,Void>() {
589 ch.write(src, (Void)null, this);
592 ch.close();
616 ch.read(dst).get();
630 final AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
631 ch.connect(server.address()).get();
640 ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null,
660 ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null,
669 ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS,
694 ch.close();
703 AsynchronousSocketChannel ch = AsynchronousSocketChannel.open())
705 ch.connect(server.address()).get();
711 ch.shutdownInput();
712 n = ch.read(buf).get();
717 n = ch.read(buf).get();
722 ch.shutdownOutput();
724 ch.write(buf).get();
744 AsynchronousSocketChannel ch = AsynchronousSocketChannel.open();
745 ch.connect(server.address()).get();
752 ch.read(dst, timeout, unit, null, new CompletionHandler<Integer,Void>() {
771 ch.read(dst);
787 ch.write(genBuffer(), timeout, unit, ch,
790 public void completed(Integer result, AsynchronousSocketChannel ch) {
791 ch.write(genBuffer(), timeout, unit, ch, this);
793 public void failed(Throwable exc, AsynchronousSocketChannel ch) {
808 ch.write(genBuffer());
823 ch.close();