Microsoft KB Archive/234576

= BUG: VBCE Winsock Control Might Not Receive Binary Data =

Article ID: 234576

Article Last Modified on 8/19/2005

-

APPLIES TO


 * Microsoft Windows CE Toolkit for Visual Basic 6.0

-



This article was previously published under Q234576



SYMPTOMS
When you use the Winsock control to try to receive binary data (that is, a bitmap, and so forth), you might only receive a subset of your data. In the DataArrival event, you can verify that the correct number of bytes is received, but you cannot get all of the data using the GetData method.

The documentation for the GetData method of the Windows CE Winsock Control incorrectly states:

GetData supports only strings and arrays of integers. It is common to use the GetData method with the DataArrival event.

The Winsock control for the Windows CE Toolkit for Visual Basic 6.0 only supports strings.



CAUSE
The CE Winsock control only retrieves data to the first ASCII 0 it receives, and then it stops.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new Windows CE H/PC or H/PC Pro project in Visual Basic. Form1 will be created by default. The application runs in emulation by default. Select Components from the Project menu and add the Microsoft CE Winsock Control to the project. Add a command button to Form1. Copy a bitmap or other binary file to the root of your Web server's content directory.  Paste the following code into Form1: Private Sub Form_Load 'Note: replace with your Web server's IP address Winsock1.RemoteHost = "127.0.0.1" Winsock1.Protocol = sckTCPProtocol Winsock1.RemotePort = 80 Winsock1.Connect End Sub

Private Sub WinSock1_DataArrival(ByVal bytesTotal As Long) Dim strData Winsock1.GetData strData MsgBox "Bytes Total is " & bytesTotal & " data is " & strData End Sub

Private Sub Command1_Click 'You can replace lanmannt.bmp with the name of the file 'you put in your Web server's content directory Winsock1.SendData "GET /lanmannt.bmp" & vbCrLf & vbCrLf End Sub  Run the application and click the command button. Note that you receive only a portion of the data from the bitmap, and you are not able to receive any more data until the program is reset.</li></ol>

Additional query words: vbce vbce6 wince wce

Keywords: kbbug kbtoolkit kbpending KB234576

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.