用Winsock,UDP协议传输文件,有没有什么办法传输到8K以上

解决方案 »

  1.   

    有很多方法我用的是转成BASE64编码的文件, 再用发文本的方式发出去, 回头后再装回去的  毕竟发文本字符串稳定点, 代码还容易写
      

  2.   

    如何转 可以参考  http://jinesc.6600.org/myweb/disp.asp?idd=1174&room=1030
      

  3.   

    有听过用BASE64编码,不过都没看到过,这是怎么转的
      

  4.   

    能不能提供部份关于BASE64编码转化的代码让我看看,谢谢
      

  5.   

    如何转 可以参考  http://jinesc.6600.org/myweb/disp.asp?idd=1174&room=1030
      

  6.   

    奇怪,传送8K以上数据与BASE64有关系么?
    拆分传送就是了.那用得着BASE64???钻牛角啊...
      

  7.   

    用BASE64做甚,分开传不就OK了,用BASE64只会影响传送的速度与性能
      

  8.   

    用BASE64编码的好处是, 传输一个个字符 比直接传输文本的代码好写多了  节约时间的    我是这样做的 服务器端:                 StatusBar1.Panels(4).Text = "Base64解码"
                     On Error Resume Next
                     Kill App.Path & "\temp.tmp"
                     On Error GoTo 0
                     '把解码文件
                    StatusBar1.Panels(4).Text = "发送文件中 ....."
                    Base64EncodeFile App.Path & "\realtime.jpg", App.Path & "\temp.tmp"
                    txtOUTput = ""
                    tcpServer.SendData "Send Start"
                    Open App.Path & "\temp.tmp" For Input As #1
                        Do While Not EOF(1)
                            Line Input #1, t1
                            tcpServer.SendData t1 & vbCrLf
                         Loop
            
                    Close #1
                    tcpServer.SendData "Send Over"                StatusBar1.Panels(4).Text = "发送文件结束 ....."
      

  9.   

    客户端:  tcpClient.GetData A  If Right(A, Len("Send Over")) = "Send Over" Then
            '开始写文件
            Print #2, Left(A, InStr(A, "Send Over") - 1)
            Close #2
            txtOUTput.Tag = ""
            '拼装回原来的文件
            Base64DecodeFile App.Path & "\remot.tmp", App.Path & "\remot.jpg"
            Picture1.Cls
           
            Picture1.Picture = LoadPicture(App.Path & "\remot.jpg")
            Picture1.Print " "
            Picture1.Print "X-CAM查看时间:" & Now
            Picture1.Refresh
            tcpClient.SendData "Close"
            'tcpClient.Close
        End If
        If txtOUTput.Tag = "Start" Then
        '中途多次发包
            Print #2, A
        End If
        If Left(A, Len("Send Start")) = "Send Start" Then '开始接收
            txtOUTput = ""
            txtOUTput.Tag = "Start"
            Open App.Path & "\remot.tmp" For Output As #2 ' 开始拼装        Print #2, Mid(A, Len("Send Start") + 1)
        End If