💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
```erlang 1、启动 方式一:启动inets应用,一个缺省profile的管理进程将被启动。 inets:start(). 方式二:运行时,动态启动profile停止profile。 动态启动profile:{ok, Pid} = inets:start(httpc, [{profile, foo}]). 动态停止profile:inets:stop(httpc, foo) 或 inets:stop(httpc, Pid). 2、设置 httpc:set_options() -< ok | {error, Reason}参考:http://www.erlang.org/doc/man/httpc.html#set_options-1 3、请求参考:http://www.erlang.org/doc/man/httpc.html#request-1 同步请求:{ok, {{Version, 200, ReasonPhrase}, Headers, Body}} = httpc:request("http://www.baidu.com"). 等同于    {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} = httpc:request(get, {"http://www.baidu.com", []}, [], []). 异步请求: {ok, RequestId} = httpc:request(get, {"http://www.baidu.com", []}, [], [{sync, false}]), receive {http, {RequestId, Result}} -< ok after 500 -< error end. 4.httpc:request(get, {Url, Header}, [{timeout, ?TimeOut}], [{sync, false}]). {ok, {{_Protocol, 200, _State}, _Head, Html}} {ok, {{_Protocol, 302, _State}, _Head, Html}} {error, Reason} 5.httpc:request(post, {Url, Header,Content_type, Post }, [{timeout, ?TimeOut}], []). {ok, {{_Protocol, 200, _State}, _Head, Html} {ok, {{_Protocol, 302, _State}, _Head, Html} {error, Reason} Post = "a=b&c=d" inets:start(), httpc:set_options([{max_keep_alive_length,500},{max_sessions,100},{nodelay,true},{reuseaddr,true}]), 参数详解: max_keep_alive_length: 在同一条http连接上允许发送的最大包数,默认为5,超过5个包,就会重连 max_sessions:跟目标服务器之间最大的并行http连接数目,大大的增加了数据上行吞吐量 nodelay_true:开启linux中的TCP_NODELAY参数,请搜索:TCP_NODELAY 40毫秒延迟 reuseaddr:允许系统复用port,对于高吞吐的系统,这个参数很重要,请搜索:linux port 复用 ```