关于Winsock的RemoteHost问题

wolf516 2003-10-16 10:48:02
小弟是个菜鸟,编程时出现了很多问题。
我想通过winsock下载网页、文件。但是关于RemoteHost主机名总会出现问题。
例如:
With Winsock1
.RemoteHost = "www.sohu.com"
.RemotePort = 80
.Connect
End With
以上设置程序运行后无错误,网页及图片等链接都可以下载

With Winsock1
.RemoteHost = "www.sina.com.cn"
.RemotePort = 80
.Connect
End With
但是某些网页如sina,照以上设置,winsock根本不响应
Private Sub Winsock1_Connect()事件。

请指教.
注:如遇到跳转服务器(转链接)的情况时又如何确定服务名。
...全文
529 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
a11s 2003-11-03
  • 打赏
  • 举报
回复
HTTP/1.0 400 Bad Request
Server: squid/2.5.STABLE3
你的请求有问题,然后他的回复上说:
<LI>Missing or incorrect access protocol (should be `http://'' or similar)
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
估计原因是第一种,你的请求没有加协议
连接之后还有许多步骤,建议你去看一下RFC文档,关于HTTP协议
wolf516 2003-11-03
  • 打赏
  • 举报
回复
唉。算啦。我以放弃改用Inet控件了。
aha99 2003-10-23
  • 打赏
  • 举报
回复
既然ie不用设置,应该不会有问题呀。。。
wolf516 2003-10-23
  • 打赏
  • 举报
回复
我是通地代理上网的。
代理采用inet共享方式。
我只需要设置网关即可上网。IE设置为默认状态
900126 2003-10-17
  • 打赏
  • 举报
回复
都可以下载。
是否你的网络环境的问题呢?介绍你的网络环境。
jie_csdn 2003-10-17
  • 打赏
  • 举报
回复
重定向,或者请求的时候的主机头问题
wolf516 2003-10-16
  • 打赏
  • 举报
回复
好像是重定向问题。有没有方法解决??
不能下载:
www.sina.com.cn
www.263.com
可以下载:
www.sohu.com
www.yeah.net
wolf516 2003-10-16
  • 打赏
  • 举报
回复
以下为下载的信息
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="www.sina.com.cn">www.sina.com.cn</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Invalid URL
</STRONG>
</UL>

<P>
Some aspect of the requested URL is incorrect. Possible problems:
<UL>
<LI>Missing or incorrect access protocol (should be `http://'' or similar)
<LI>Missing hostname
<LI>Illegal double-escape in the URL-Path
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:webmaster">webmaster</A>.

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Thu, 16 Oct 2003 03:12:22 GMT by sq234.sina.com.cn (squid/2.5.STABLE3)
</ADDRESS>
</BODY></HTML>
wolf516 2003-10-16
  • 打赏
  • 举报
回复
以下为下载的头信息:
HTTP/1.0 400 Bad Request
Server: squid/2.5.STABLE3
Mime-Version: 1.0
Date: Thu, 16 Oct 2003 03:13:02 GMT
Content-Type: text/html
Content-Length: 1170
Expires: Thu, 16 Oct 2003 03:13:02 GMT
X-Squid-Error: ERR_INVALID_URL 0
X-Cache: MISS from sq231.sina.com.cn
X-Cache-Lookup: NONE from sq231.sina.com.cn:80
Proxy-Connection: close
900126 2003-10-16
  • 打赏
  • 举报
回复
我用是可以的,多试验几次。
900126 2003-10-16
  • 打赏
  • 举报
回复
被重定向了吧

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧