创建非

欢马劈雪     最近更新时间:2020-01-02 10:19:05

450
创建非阻塞服务器套接字

import java.awt.Graphics;

import java.io.IOException;

import java.net.InetSocketAddress;

import java.nio.channels.ServerSocketChannel;
/*
N o w J a v a . c o m - 时  代  Java
*/


public class Main {

  public void m() {

    // Create a non-blocking server socket and check for connections

    try {

      // Create a non-blocking server socket channel on port 80

      ServerSocketChannel ssChannel = ServerSocketChannel.open();

      ssChannel.configureBlocking(false);

      int port = 80;

      ssChanne
展开阅读全文