2007-08-14
erlang inet:setopts 未公开选项
关键字: erlang setopts- inet:setopt有packet设置选项:
-
{packet, PacketType}(TCP/IP sockets) - Defines the type of packets to use for a socket. The following values are valid:
-
raw | 0 - No packaging is done.
-
1 | 2 | 4 - Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. The length of header can be one, two, or four bytes; the order of the bytes is big-endian. Each send operation will generate the header, and the header will be stripped off on each receive operation.
-
asn1 | cdr | sunrm | fcgi | tpkt | line - These packet types only have effect on receiving. When sending a packet, it is the responsibility of the application to supply a correct header. On receiving, however, there will be one message sent to the controlling process for each complete packet received, and, similarly, each call to
gen_tcp:recv/2,3returns one complete packet. The header is not stripped off.
The meanings of the packet types are as follows:
asn1- ASN.1 BER,
sunrm- Sun's RPC encoding,
cdr- CORBA (GIOP 1.1),
fcgi- Fast CGI,
tpkt- TPKT format [RFC1006],
line- Line mode, a packet is a line terminated with newline, lines longer than the receive buffer are truncated. - 文档中写的就这么多了 其实还有2个选项:http, httph 用于解释http的请求
-
- #ifdef USE_HTTP
- 。。。
- #endif
** load http message:
** {http_eoh, S} - end of headers
** {http_header, S, Key, Value} - Key = atom() | string()
** {http_request, S, Method,Url,Version}
** {http_response, S, Version, Status, Message}
** {http_error, S, Error-Line}
*/
消息以上面的方式发给process,用于gen_tcp
由于在driver层面实现的 所以效率就很高,对于编写http隧道之类的程序 很有帮助哦
- 浏览: 71941 次
- 性别:

- 来自: 广州

- 详细资料
搜索本博客
最近加入圈子
链接
最新评论
-
tail程序 c版本和lua版本 ...
不错,有点意思,支持一下楼主
-- by liuming -
tail程序 c版本和lua版本 ...
[root@test98 haproxy]# ls -lh /var/log/h ...
-- by mryufeng -
tail程序 c版本和lua版本 ...
把/var/log/haproxy.log拷三份来测比较准吧
-- by Sam1860 -
tail程序 c版本和lua版本 ...
算法基本一样, lua重复利用现有的c native 实现, c程序大概是lua ...
-- by mryufeng -
tail程序 c版本和lua版本 ...
你俩个算法都不一样比较啥啊?
-- by makefile






评论排行榜