`
lixjluck
  • 浏览: 101812 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

TCP的几个常用参数

阅读更多

<!--[if !supportMisalignedColumns]--><!--[endif]-->

 

 

 

SO_LINGER

Specify a linger-on-close timeout. This option disables/enables immediate return from a close()of a TCP Socket.  Enabling this option with a non-zero Integer timeout  means that a close() will block pending the transmission and acknowledgement of all data written to the peer, at which point the socket is closed gracefully. Upon reaching the linger timeout, the socket is closed forcefully, with a TCP RST. Enabling the option with a timeout of zero does a forceful close immediately. If the specified timeout value exceeds 65,535 it will be reduced to 65,535.

SO_TIMEOUT

Set a timeout on blocking Socket operations:

     * <PRE>

     * ServerSocket.accept();

     * SocketInputStream.read();

     * DatagramSocket.receive();

     * </PRE>

The option must be set prior to entering a blocking operation to take effect. If the timeout expires and the operation would continue to block, <B>java.io.InterruptedIOException</B> is raised.  The Socket is not closed in this case.

SO_SNDBUF

Set a hint the size of the underlying buffers used by the platform for outgoing network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be sent over the socket. When used in get, this must return the size of the buffer actually used by the platform when sending out data on this socket.

SO_RCVBUF

Set a hint the size of the underlying buffers used by the platform for incoming network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be received over the

socket. When used in get, this must return the size of the buffer actually used by the platform when receiving in data on

 this socket.

SO_KEEPALIVE

When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for  2 hours (NOTE: the actual value is implementation dependent),

     * TCP automatically sends a keepalive probe to the peer. This probe is a TCP segment to which the peer must respond.

     * One of three responses is expected:

     * 1. The peer responds with the expected ACK. The application is not    notified (since everything is OK). TCP will send another probe following another 2 hours of inactivity.

     * 2. The peer responds with an RST, which tells the local TCP that the peer host has crashed and rebooted. The socket is closed.

     * 3. There is no response from the peer. The socket is closed.

     * The purpose of this option is to detect if the peer host crashes.

SO_REUSEADDR

Used by MulticastSockets

TCP_NODELAY

Disable Nagle's algorithm for this connection.  Written data to the network is not buffered pending acknowledgement of previously written data

public void connect(SocketAddress endpoint, int timeout)

 

       

 

Nagle's algorithmhttp://en.wikipedia.org/wiki/Nagle's_algorithm

Socket-faq: ftp://rtfm.mit.edu/pub/usenet/news.answers/unix-faq/socket

 

 

分享到:
评论

相关推荐

    TCP拦截和网络地址转换

    T C P拦截这一部分,最后给出几个使用该特性的 示例。之后,介绍 N AT的整体概念,包括 N AT的引入、 N AT特性以及如何将其用于网络中。 最后将讨论有关N AT的配置和调试命令,并介绍许多详细的示例。 8.1 TCP...

    入门学习Linux常用必会60个命令实例详解doc/txt

    建议在/mnt里建几个/mnt/cdrom、/mnt/floppy、/mnt/mo等目录,当作目录的专用挂载点。举例而言,如要挂载下列5个设备,其执行指令可能如下 (假设都是Linux的ext2系统,如果是Windows XX请将ext2改成vfat): 软盘 ==...

    S扫描器

    打开S扫描器,下面我举几个例子演示下S扫描器的主要几个作用。 例子一: S TCP 218.80.12.1 218.80.12.123 80 512 TCP扫描218.80.12.1到218.80.12.123这IP段中的80端口,最大并发线程是512 例子二: S TCP...

    DOS网络命令

    常用实用的几个DOS命令的用法,nbtstat 该命令使用TCP/IP上的NetBIOS显示协议统计和当前TCP/IP连接,使用这个命令你可以得到远程主 机的NETBIOS信息,比如用户名、所属的工作组、网卡的MAC地址等。在此我们就有...

    S.exe端口扫描器

    打开S扫描器,下面我举几个例子演示下S扫描器的主要几个作用。 例子一: S TCP 218.80.12.1 218.80.12.123 80 512 TCP扫描218.80.12.1到218.80.12.123这IP段中的80端口,最大并发线程是512 例子二: S TCP 218...

    UNIX操作系统培训

    1.3 与UNIX有关的几个名词 7 第2章 UNIX常用操作 9 2.1 启动终端 9 2.2 登录 9 2.3 UNIX命令 9 2.4 注销(退出UNIX系统) 13 第3章 UNIX文件系统 14 3.1 UNIX文件系统分类 14 3.2 UNIX文件类型 14 3.3 UNIX树型目录...

    unix操作系统培训教材.doc

    1.3 与UNIX有关的几个名词 4 第2章 UNIX常用操作 5 2.1 启动终端 5 2.2 登录 5 2.3 UNIX命令 5 2.4 注销(退出UNIX系统) 7 第3章 UNIX文件系统 8 3.1 UNIX文件系统分类 8 3.2 UNIX文件类型 8 3.3 UNIX树型目录结构 ...

    华为unix操作系统培训教材

    1.3 与UNIX有关的几个名词 4 第2章 UNIX常用操作 5 2.1 启动终端 5 2.2 登录 5 2.3 UNIX命令 5 2.4 注销(退出UNIX系统) 7 第3章 UNIX文件系统 8 3.1 UNIX文件系统分类 8 3.2 UNIX文件类型 8 3.3 UNIX树型目录结构 ...

    windump最新版

    下面我举几个常用例子介绍一下这个工具的使用方法。 1、windump –D 列出本机可供抓包的全部接口。 这个命令在本机有多个网卡时非常有用。比如,我的机器装有3块网卡,而我只抓第二块网卡上的包,那么我用windump ...

    nc端口监听工具瑞士军刀

    nc的控制参数不少,常用的几个参数如下所列: 1) -l 用于指定nc将处于侦听模式。指定该参数,则意味着nc被当作server,侦听并接受连接,而非向其它地址发起连接。 2) -p 暂未用到(老版本的nc可能需要在...

    unix大全(涵盖了UNIX学习的方方面面)

    18.性能相关的几个核心参数(CPU,I/O,MEMORY) 19.SCO NFS详解 20.SCO命令--df 21.SCO OpenServer 5.0.5中DHCP如何配置 ? 22.ESQL编程使用说明 23.UnixWare 7 root口令遗失的解决方法 24.SCO UNIX 讲座 25.Sco open...

    常用的DOS命令

    在此我们就有必要了解几个基本的参数。 -a 使用这个参数,只要你知道了远程主机的机器名称,就可以得到它的NETBIOS信息(下同)。 -A 这个参数也可以得到远程主机的NETBIOS信息,但需要你知道它的IP。 -n 列出...

    go-any-proxy:透明的TCP代理(无需解密)(golang)。 它可以转发到上游代理(例如公司),并通过上游代理在任何端口上进行CONNECT,从而提供对外部Internet资源的Internet访问。

    任何代理go-any-proxy是可以通过上游代理服务器透明地代理任何tcp连接的服务器。 这种类型的设置在公司环境中很常见。 它是用golang编写的,并且已在运行64位内核的Vyatta上成功进行了10,000个并发连接的负载测试。...

    计算机网络课程设计---端口扫描工具设计.docx

    常用端口扫描技术 TCP connect()扫描: 这是最基本的TCP扫描,操作系统提供的connect()系统调用可以用来与每一个感兴趣的目标计算机的端口进行连接。如果端口处于侦听状态,那么connect()就能成功。否则,这个端口...

    计算机应用基础(题型版)网络基础.doc

    A:几个主机直接连接起来 B:几个服务器直接连接起来 C:几个主机和服务器通过广域网连接起来 D:几个局域网通过广域网连接起来 答案:D 14、连接到Internet的计算机中,必须安装的协议是________。 A:HTTP协议 B...

    最全的oracle常用命令大全.txt

    用系统管理员,查看当前数据库有几个用户连接: SQL&gt; select username,sid,serial# from v$session; 如果要停某个连接用 SQL&gt; alter system kill session 'sid,serial#'; 如果这命令不行,找它UNIX的进程数 SQL&gt;...

    基于Qt的多线程流水线异步服务器稳定版

    服务由以下几个模块组成. 1、 网络传输模块。负责管理用于监听、传输的套接字,并控制数据流在不同线程中流动。数据收发由一定规模的线程池负责,实现方法完全得益于Qt的线程事件循环。被绑定到某个Qthread上的...

    Ghost 8.3 系统备份软件

    但与此同时,几十个参数会令普通用户头疼,因此笔者不推荐一般用户使用,Symantec 公司也应该推出相应的GUI(图形用户界面)控制台以方便用户使用。具体的参数说明可以用命令行 gdisk/? 了解。 C.Live Update ...

    Ghost 8.3 Enterprise

    但与此同时,几十个参数会令普通用户头疼,因此笔者不推荐一般用户使用,Symantec 公司也应该推出相应的GUI(图形用户界面)控制台以方便用户使用。具体的参数说明可以用命令行 gdisk/? 了解。  C.Live Update  ...

Global site tag (gtag.js) - Google Analytics