Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Socketexception未处理-vb.net_Vb.net_Datetime - Fatal编程技术网

Socketexception未处理-vb.net

Socketexception未处理-vb.net,vb.net,datetime,Vb.net,Datetime,我试图从互联网上获得时间来使用我的工具 我从stackoverflow这里得到了这个,它是c语言,转换成vb Dim client = new tcpclient("time.nist.gov", 13) Using streamreader = new streamreader(client.getstream()) dim response = streamreader.readtoend() dim utcdatetimestring = response.substr

我试图从互联网上获得时间来使用我的工具

我从stackoverflow这里得到了这个,它是c语言,转换成vb

 Dim client = new tcpclient("time.nist.gov", 13)
 Using streamreader = new streamreader(client.getstream())
    dim response = streamreader.readtoend()
    dim utcdatetimestring = response.substring(7, 17)
    dim localdatetime = datetime.parseexact(utcdatetimestring, "yy-MM-dd HH:mm:ss", cultureinfo.invariantculture, datetimestyles.assumeuniversal)
 End using

我收到一个连接尝试失败,因为连接方在一段时间后没有正确响应。。。错误。

嗯,是的,因为您的计算机确定端口不安全,所以我的端口不安全。你可以访问基于PHP的Web服务器吗?这段代码适合我,所以可能是防火墙/代理问题?