Hi,
I had a go today at making my own file transfer example. This is what I have so far but I can't get in to work properly. What code do I need to add?
VB Code:
'Client Code Dim file As String Dim Blocksize As Long Dim NF As Integer Private Sub Command1_Click() CommonDialog1.ShowOpen Text1.Text = CommonDialog1.FileTitle End Sub Private Sub Command2_Click() Winsock1.Connect "127.0.0.1", "7000" End Sub Private Sub Command3_Click() NF = FreeFile Open CommonDialog1.filename For Binary Access Read As #NF file = Space$(Blocksize) Get #NF, , file Do Until EOF(NF) Winsock1.SendData file Loop Close #NF End Sub 'Server Code Dim file As String Dim dat As String Dim NF As Integer Private Sub Form_Load() Winsock1.LocalPort = 7000 Winsock1.Listen End Sub Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State <> sckClosed Then Winsock1.Close Winsock1.Accept requestID End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) On Error Resume Next Winsock1.GetData dat If InStr(1, dat, "|DATA|") <> 0 Then NF = FreeFile Open App.Path & "\test.exe" For Binary Access Write As #NF Put #NF, , file Close #NF End If End Sub
Please give me some help to point me in the right direction.
TIA
NW




Reply With Quote