给你一个例子
'==============================================
'Written by Igor Ostrovsky ([email protected])
'Visual Basic 911 (http://www.ostrosoft.com/vb)
'==============================================
Option Explicit
Dim StrFileTitle As String
Dim buffer() As Byte
Dim lBytes As Long
Dim IsLastSend As BooleanPrivate Sub cmdBrowse_Click()
  dlg.ShowOpen
  txtFile = dlg.FileName
  StrFileTitle = dlg.FileTitle
End SubPrivate Sub cmdSend_Click()
  cmdSend.Enabled = False
  lBytes = 0
  ReDim buffer(FileLen(dlg.FileName) - 1)
  Open dlg.FileName For Binary As 1
  Get #1, 1, buffer
  Close #1
  Load wsTCP(1)
  IsLastSend = False
  wsTCP(1).RemoteHost = "172.0.0.1"
  wsTCP(1).RemotePort = 2222
  wsTCP(1).Connect
  lblStatus = "Connecting..."
End SubPrivate Sub wsTCP_Close(Index As Integer)
  lblStatus = "Connection closed"
  Unload wsTCP(1)
End SubPrivate Sub wsTCP_Connect(Index As Integer)
     lblStatus = "Connected"
     wsTCP(1).SendData StrFileTitle
End SubPrivate Sub wsTCP_DataArrival(Index As Integer, ByVal bytesTotal As Long)
     wsTCP(1).SendData buffer
     IsLastSend = True
End SubPrivate Sub wsTCP_SendComplete(Index As Integer)
  lblStatus = "Send complete"
  If IsLastSend Then
     Unload wsTCP(1)
     cmdSend.Enabled = True
     IsLastSend = False
  End If
End SubPrivate Sub wsTCP_SendProgress(Index As Integer, ByVal bytesSent As Long, ByVal bytesRemaining As Long)
  lBytes = lBytes + bytesSent
  lblStatus = lBytes & " out of " & UBound(buffer) & " bytes sent"
End Sub