请问怎样使用Winsock访问Http网站?-----请网络高手看看。
我的代码如下:
tcpClient.Protocol = sckTCPProtocol
tcpClient.RemoteHost = txtURL.Text
tcpClient.RemotePort = 80
tcpClient.Connect
其中,tcpClient是Winsock控件。
当 txtURL为本机地址或者局域网服务器地址时,连接正常。
当访问外部网站,如www.sina.com.cn时,就报“11001,主机未找到”错误。
而且Get命令也得不到任何信息回应。
tcpClient.SendData "GET " + txtURL + "/index.htm " + "HTTP/1.1"