启动ibrowse以支持对服务器的无限请求

时间:2017-10-04 15:38:40

标签: erlang yaws nitrogen erlang-ports inets

我正在使用ibrowse向外部服务器发出POSTGET请求,但在支持频繁和同时请求方面我遇到了问题。

我使用默认设置启动ibrowse

application:start(ibrowse).

然后我使用ibrowse执行POST次请求:

ibrowse:send_req("http://somelink.com/api/capi/send.php?" ++ Data,[],get,[]).   

或:

ibrowse:send_req("http://somelink.com/cgi-bin/send",[{"Content-Type", "application/x-www-form-urlencoded"}],post,Data).

当我调用该函数时,它会在第一次尝试时成功使用此结果:

 [{http_code,"202"},
  {http_headers,[{"Server","CCSRouter/0.1"},
                 {"Content-Length","34"},
                 {"Content-type","text/html"},
                 {"Pragma","no-cache"},
                 {"Cache-Control","no-cache"}]},
  {result,"status=1"}],

但是当我反复调用该函数时,它无法返回以下错误:

{error,{conn_failed,{error,econnrefused}}}

如何确保无论何时与ibrowse进行高频连接,都会成功?

0 个答案:

没有答案
相关问题