Archived

This topic is now archived and is closed to further replies.

Fma

VB6 Winsock Problem

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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 ]

Share this post


Link to post
Share on other sites