(VB,Winsock) Extracting data from socket. 
Author Message
 (VB,Winsock) Extracting data from socket.

Hello,

I'm developing a VB Client app that receives data from a server via Winsock.

The Winsock server is developed in C++  and the Client in VB6

The VB client receives the following message from the server:

numeric_field  (1 byte)  --->  maps to VB Byte datatype
string_field   (2 bytes)  --->  maps to VB String datatype
float_field   (4 bytes)  --->  maps to VB Single datatype

These fields arrives as a single string, so the client receives 7 bytes.

Is there a way to "extract" these data into simple VB variables?

Thanks in advance

Joseph



Fri, 11 Apr 2003 03:00:00 GMT  
 (VB,Winsock) Extracting data from socket.

Type myrec
    num_field        As Byte
    str_field           As String * 2
    flt_field            As Single
End Type

Dim mydata As myrec

Let mydata = winsockreceivebuffer

Hope this helps

Alex

Joseph Toulier schrieb in Nachricht ...

Quote:
>Hello,

>I'm developing a VB Client app that receives data from a server via
Winsock.

>The Winsock server is developed in C++  and the Client in VB6

>The VB client receives the following message from the server:

>numeric_field  (1 byte)  --->  maps to VB Byte datatype
>string_field   (2 bytes)  --->  maps to VB String datatype
>float_field   (4 bytes)  --->  maps to VB Single datatype

>These fields arrives as a single string, so the client receives 7 bytes.

>Is there a way to "extract" these data into simple VB variables?

>Thanks in advance

>Joseph



Fri, 11 Apr 2003 03:00:00 GMT  
 (VB,Winsock) Extracting data from socket.
Sorry, it's LSet, not Let !

LSet mydata = winsockreceivebuffer

RtlMoveMemory might be an alternative.

Alex

Alexander Kienzle schrieb in Nachricht ...

Quote:
>Type myrec
>    num_field        As Byte
>    str_field           As String * 2
>    flt_field            As Single
>End Type

>Dim mydata As myrec

>Let mydata = winsockreceivebuffer

>Hope this helps

>Alex

>Joseph Toulier schrieb in Nachricht ...
>>Hello,

>>I'm developing a VB Client app that receives data from a server via
>Winsock.

>>The Winsock server is developed in C++  and the Client in VB6

>>The VB client receives the following message from the server:

>>numeric_field  (1 byte)  --->  maps to VB Byte datatype
>>string_field   (2 bytes)  --->  maps to VB String datatype
>>float_field   (4 bytes)  --->  maps to VB Single datatype

>>These fields arrives as a single string, so the client receives 7 bytes.

>>Is there a way to "extract" these data into simple VB variables?

>>Thanks in advance

>>Joseph



Mon, 14 Apr 2003 07:03:12 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. (VB,Winsock) Extracting data from socket.

2. Winsock DataArrival, socket closing and can't GetData before receiving all the data

3. ftp client,winsock.ocx and data socket

4. Socket flushing in VB (winsock)

5. Winsock Socket Error from embedded VB Form

6. Sending socket data from VB client to a JAVA based server

7. How can I read data via PCMCIA socket using VB

8. is net.socket able to block receiving data until it handles the data

9. recieve data asynchronously and send the data on the same socket

10. using vb.net to extract data from ms access

11. Extracting data from multiple tables, for use on a VB Form

12. Problem on extracting data from DB thru VB...

 

 
Powered by phpBB® Forum Software