请VB的兄弟帮忙看看这段代码哪有问题,谢了!

来源:百度知道 编辑:UC知道 时间:2024/04/30 07:49:20
下面的代码是文件传输,本人测试可以传送,在传送二三百K的文件大多能成功传输,大于三四五百K的文件有时能传成功有时不能传成功,卡在过程中了,上M的就根本不成功。麻烦兄弟们帮我查查哪出问题了。

'下面的代码既是服务器又是客户端

'采用应答式发送方式

'自动拆分文件,包括2进制
Option Explicit
'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim mybyte() As Byte '发送方数组
Const filecomesMSG = "a file is coming " '有文件到来
Const RemoteIsReadyMSG = "sender is ready " '准备好了
Const FileisOverMSG = "the file is ended" '文件完毕
Const RemoteDenyMSG = "the user canceled" '用户取消
Const filecountMSG = "the file lengh is" '文件长度
Const RecevieIsReadyMSG = "Receiver is ready " '准备接收
Dim arrdata() As Byte '收到的信息
Dim filesave As Integer '保存文件的句柄
Dim filehandle As Integer '发送方文件的句柄
Dim FileSize As Double '文件的大小
Dim Sendbyte As Long
Dim Receivebyte As Long
Dim MyLocation As Double
Dim my

gjhntilvjotyujhnbtklhljofgvbjhiojlrjtlhvujfgiohutgiouvhfgovjhnkljklrtduthioubhiotuhibjfgohujfoghujdfkljghlujniotvbhijfguhjo,面的代码是文件传输,本人测试可以传送,在传送二三百K的文件大多能成功传输,大于三四五百K的文件有时能传成功有时不能传成功,卡在过程中了,上M的就根本不成功。麻烦兄弟们帮我查查哪出问题了。

'下面的代码既是服务器又是客户端

'采用应答式发送方式

'自动拆分文件,包括2进制
Option Explicit
'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim mybyte() As Byte '发送方数组
Const filecomesMSG = "a file is coming " '有文件到来
Const RemoteIsReadyMSG = "sender is ready " '准备好了
Const FileisOverMSG = "the file is ended" '文件完毕
Const RemoteDenyMSG = "the user canceled" '用户取消
Const filecountMSG = "the file lengh is" '文件长度
Const RecevieIsReadyMSG = "Receiver is ready " '准备接收
Dim arrdata() As Byte '收到的信息
Dim filesave As Integer '保存文件的句柄
Dim filehandle As Integer '发送方