// Accept the connection and make it non-blocking
SocketChannel socketChannel = serverSocketChannel.accept();
Socket socket = socketChannel.socket();
//socket.setSoTimeout(1000*10);//it will be timeout if idle more than 10s
//after testing, i found the parameter in socketchannel didnot work
//the following is what i google:
//you don't need a timeout,
//because SC's (SC means SocketChannel) do a non-blocking Connect, and send a message to the Selector with message type CONNECTED when that becomes the case

//in the protosocket, read method is a blocking invocation, so it need a "timeout" parameter ,in case some evil connection

parameter "timeout" in socketchannel does not work的更多相关文章

  1. JUnit4:Test注解的两个属性:expected和timeout

    JUnit4:Test文档中的解释: The Test annotation supports two optional parameters. The first, expected, declar ...

  2. Test注解的两个属性:expected和timeout

    JUnit4:Test文档中的解释: The Test annotation supports two optional parameters. The first, expected, declar ...

  3. ajax 请求 对json传的处理 Jquery 使用Ajax获取后台返回的Json数据后,页面处理

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. JUnit4注解基本介绍

    @After If you allocate external resources in a Before method you need to release them after the test ...

  5. net programming guid

    Beej's Guide to Network Programming Using Internet Sockets Brian "Beej Jorgensen" Hallbeej ...

  6. Jquery 使用Ajax获取后台返回的Json数据后,页面处理

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Jenkins持续集成学习-Windows环境进行.Net开发2

    目录 Jenkins持续集成学习-Windows环境进行.Net开发2 目录 前言 目标 使用 .Net Stardard 单元测试 流程 手动执行单元测试 自动执行单元测试 单元测试报告 上传Nug ...

  8. Java NIO通信的基础,基于TCP C/S例子介绍

    为了更好的理解Netty异步事件驱动网络通信框架,有必要先了解一点Java NIO原生的通信理论,下面将结合基于TCP的例子程序,含客户端和服务端的源码,实现了Echo流程. Java NIO的核心概 ...

  9. MQTT协议笔记之mqtt.io项目HTTP协议支持

    前言 MQTT协议诞生之初,就未曾考虑通过HTTP传输.这也正常,网络受限.不稳定网络不太适合HTTP(2G/3G网络大家使用WAP不也OK嘛).在网络较为充裕的桌面端而言,虽纯文本对比二进制而言没多 ...

随机推荐

  1. Set 集合论

    https://en.m.wikipedia.org/wiki/De_Morgan%27s_laws https://plato.stanford.edu/entries/set-theory/ ht ...

  2. Artificial-Intelligence BOOKs与算法

    http://mindhacks.cn/2008/09/11/machine-learning-and-ai-resources/ https://www.amazon.com/Information ...

  3. 基于jQuery+ashx+.net实现三级栏目联动操作

    父级ID可以为空以两个编号为一级 可以添加到第四级 table 字段有ID. name .parentNode. childNode等基本属性  selecet  parentNode  ,len(c ...

  4. hdoj 2717 Catch That Cow

    Problem Description Farmer John has been informed of the location of a fugitive cow and wants to cat ...

  5. 【转】Java对日期Date类进行加减运算,年份加减,月份加减

    import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date; public class Date ...

  6. 也谈免拆机破解中兴B860av1.1(解决不能安装软件/解决遥控)

    20170221更新   部分用户(自己恢复出厂测试过),操作后仍然无法直接在当贝市场安装应用了,    在第8条,最后两步,先改为中国通用市场,后面再改为未知局方.    如果开机想优先启动当贝桌面 ...

  7. C#中一道关于员工信息系统的题(主要考察LinQ和正则表达式验证)

    今天上午进行了公司的C# C level考核,最后一道编程题是关于员工信息系统的,题目的要求大概是这样的:1.要可以保存员工信息(XXXXX),并且要用正则表达式对输入信息进行验证:2.要可以对员工信 ...

  8. asp.net显示用户信息

    web.config <?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应 ...

  9. iostbleView刷新后显示指定cell

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_q ...

  10. [posix]Posix多线程编程

    就不排版了,可以到原作者博客下看 转自:http://www.cnblogs.com/zhangsf/archive/2013/09/09/3309867.html 目录表  摘要 译者序 Pthre ...