需要BSD-Socket选项说明

时间:2010-05-28 07:09:38

标签: sockets

我想要bsd-socket选项的详细解释,以便我能以正确的方式使用它们。有人可以提供一些我可以参考的文件或链接吗?

谢谢, Satinder Singh Khera.satinder@rediffmail.com

2 个答案:

答案 0 :(得分:1)

Beej's Guide to Network Programming是一个开始寻找的好地方。

如果你专门谈论get / setsockopt,Beej说this。他进一步指出get / setsockopt通常依赖于操作系统,在这种情况下请查阅您的手册页,MSDN或其他任何内容。

答案 1 :(得分:0)

以下是http://www.sockets.com

的列表
Value       Type        Meaning
--------------- --------------- -----------------------------------------------
SO_BROADCAST    BOOL        Allow transmission of broadcast messages on the
                socket.

SO_DEBUG    BOOL        Record debugging information.  

SO_DONTLINGER   BOOL        Don't block close waiting for unsent data to be
                sent.  Setting this option is equivalent to
                setting SO_LINGER with l_onoff set to
                zero.

SO_DONTROUTE    BOOL        Don't route: send directly to interface.

SO_KEEPALIVE    BOOL        Send keepalives

SO_LINGER   struct linger   Linger on close if unsent data is present
        FAR *

SO_OOBINLINE    BOOL        Receive out-of-band data in the normal data
                stream.  

SO_RCVBUF   int     Specify buffer size for receives

SO_REUSEADDR    BOOL        Allow the socket to be bound to an address
                which is already in use.  (See bind().)

SO_SNDBUF   int     Specify buffer size for sends

TCP_NODELAY BOOL        Disables the Nagle algorithm for send
                coalascing.

SO_ACCEPTCON    BOOL        Socket is listening

SO_ERROR    int     Get error status and clear

SO_RCVLOWAT int     Receive low water mark

SO_RCVTIMEO int     Receive timeout

SO_SNDLOWAT int     Send low water mark

SO_SNDTIMEO int     Send timeout

SO_TYPE     int     Type of the socket

IP_OPTIONS          Set options field in IP header.