图片处理
谁有用winsock控件传送图片文件的代码?
请贴一下
多谢!!!!!
另外帮忙看看我的代码问题出在哪里?
服务器代码:************************************************
Option Explicit
Private wskI As Long
Private Sub Form_Load()
wskI = 0
wskS(0).Protocol = sckTCPProtocol
wskS(0).LocalPort = 8000
wskS(0).Listen
End Sub
Private Sub wskS_ConnectionRequest(Index As Integer, ByVal requestID As Long)
wskI = wskI + 1
Load wskS(wskI)
wskS(wskI).Accept requestID
End Sub
Private Sub wskS_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim receivefile() As Byte
Dim lenth As Single
Dim i As Long
ReDim receivefile(1 To bytesTotal)
wskS(Index).GetData receivefile, vbArray + vbByte
Open App.Path & "\1.jpg" For Binary As #1
Put #1, lenth + 1, receivefile
Close #1
lenth = lenth + UBound(receivefile) - LBound(receivefile) + 1
End Sub
******************************************************************
客户端代码:******************************************************
Option Explicit
Private Sub cmdCMD_Click()
Dim myfile() As Byte
Dim position As Long
Dim FileName As String
FileName = App.Path & "\1.jpg"
position = FileLen(FileName)
ReDim myfile(position - 1) As Byte
Open FileName For Binary As #1
Get #1, , myfile
Close #1
wskC.SendData myfile
End Sub
Private Sub Form_Load()
wskC.RemoteHost = "192.168.0.100"
wskC.RemotePort = 8000
wskC.Connect
End Sub
*****************************************************************
这两段代码可以向服务器送过去一个文件
但打开却什么也看不到
为什么?