VB6 Winsock Problem
Hi
This is Kinda stupid but I'm trying to send a file using the Winsock control and this is how im doing it:
==============================================
'VB6 code
Dim FileData As String
Open FileName For Binary As #1 'the file which to be send
FileData = Space$(LOF(1))
Get #1, , FileData
Winsock1.SendData FileData
DoEvents
Close #1
==============================================
And I receive the file like this
==============================================
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long(
Dim FileData As String
Winsock1.GetData FileData, vbString
DoEvents
Open "C:\recived file" For Binary As #1
Put #1, , FileData
Close #1
End Sub
==============================================
Could some one please tell me what I am doing wrong, most of the time I end up with a corrupted file!!!!!!!!
Thanks in advance
[edited by - fma on June 7, 2002 4:41:27 PM]
[edited by - fma on June 7, 2002 4:42:26 PM]
The VB Winsock OCX breaks up large packets into 8KB chunks.
Output the size of the data being recieved to verify it''s the same as the file that was sent.
Instead of writing to a file, setup a multi-line text box and append the data you recieve to it.
The first rule of effective debugging is to output relivent variables to either a log file or the screen.
Ben
IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting ]
Output the size of the data being recieved to verify it''s the same as the file that was sent.
Instead of writing to a file, setup a multi-line text box and append the data you recieve to it.
The first rule of effective debugging is to output relivent variables to either a log file or the screen.
Ben
IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement