使用 libsoup 时出错
我正在使用 libsoup API 编写客户端。 我做了以下事情。
session = soup_session_sync_new();
msg = soup_message_new("GET","http://www.google.com");
status = soup_session_send_message(session,msg);`
但是现在我在状态中收到以下错误代码。我打印原因短语,它显示 status= 4 , msg->reason_phrase = Cannot connect to destination
我该如何解决此问题?
I am writing a client using libsoup APIs.
I have done the following.
session = soup_session_sync_new();
msg = soup_message_new("GET","http://www.google.com");
status = soup_session_send_message(session,msg);`
However now i am getting the following error code in status. I print the reason phrase and it says the status= 4 , msg->reason_phrase = Cannot connect to destination
How do i resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
问题是我使用代理服务器连接到互联网。因此,我需要使用 proxy-sever:port 值设置 SOUP_SESSION_PROXY_URI 的会话对象属性。
现在效果很好。现在是时候测试 POST 方法了。
The problem was i use a proxy server to connect to internet. Hence i needed to set the session object property of SOUP_SESSION_PROXY_URI with the proxy-sever:port value.
It works fine now. Time to test POST method now.
代码看起来完全没问题。只需尝试将 google.com 更改为其他一些更简单的站点(可能是 gnu.org),然后重试该代码。
The code seems perfectly alright. Just try changing google.com to some other simpler site, may be gnu.org, and retry the code.
以 sudo 身份运行命令对我有用。
Running the commands as sudo worked for me.