以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- post上传如何进行超时判断 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157367) |
-- 作者:pengjiam -- 发布时间:2020/10/13 16:19:00 -- post上传如何进行超时判断 这是网络上传的客户端程序,如何在其中加入超时判读,一旦网络不畅通,对未上传的数据做记录,待网络畅通后在进行上传? Dim msg As String = "head=" & head & "&body=" & body & "&updates=" & updates Dim req = System.Net.WebRequest.Create("https://www.xxx.xyz/insertage.php") req.Method = "POST" req.Timeout = 10000 req.C req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:66.0) Gecko/20100101 Firefox/66.0" Dim aryBuf As Byte() = Encoding.GetEncoding("utf-8").GetBytes(msg) req.ContentLength = aryBuf.Length Dim writer = req.GetRequestStream() writer.Write(aryBuf, 0, aryBuf.Length) writer.Close() writer.Dispose()
|
-- 作者:有点蓝 -- 发布时间:2020/10/13 16:49:00 -- try一下 try Dim msg As String = "head=" & head & "&body=" & body & "&updates=" & updates Dim req = System.Net.WebRequest.Create("https://www.xxx.xyz/insertage.php") req.Method = "POST" req.Timeout = 10000 req.C req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:66.0) Gecko/20100101 Firefox/66.0" Dim aryBuf As Byte() = Encoding.GetEncoding("utf-8").GetBytes(msg) req.ContentLength = aryBuf.Length Dim writer = req.GetRequestStream() writer.Write(aryBuf, 0, aryBuf.Length) writer.Close() writer.Dispose() catch ex as Exception msgbox("出错:" & ex.message) end try [此贴子已经被作者于2020/10/13 17:38:41编辑过]
|
-- 作者:pengjiam -- 发布时间:2020/10/13 17:34:00 -- 系统提示:未定义类型"excption" 在语句catch ex as excption之前如何定义excption? |
-- 作者:有点蓝 -- 发布时间:2020/10/13 17:39:00 -- catch ex as Exception |