Winsock.SendData Problem 
Author Message
 Winsock.SendData Problem

Ok. This has kept me baffled for 3 days now.

I have and Standard EXE which has a Control Array of Winsock Controls.
I pass Winsock Objects ByRef to a ActiveX DLL.

The following Code works perfectly inside the dll.
(I'll be referring to the Winsock as WS1)

WS1.SendData "Hello World"

In this case the client receives the message correctly.

However. When I am attempting to pass a String Variable containing the
message....

dim Message as String
Message = "Hello World"
WS1.SendData Message

The message is garbled when received by the client.

I can't seem to determine the type of the data the client is receiving,
and I'm tempted to think the problem has something to do with the
marshalling between the processes, but haven't been able to determine a
solution.

Anyone care to comment on any of this?

Frank.

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Tue, 13 Nov 2001 03:00:00 GMT  
 Winsock.SendData Problem
I am going to assume you have access to the client source also.  When
the Winsock control recieves a string, it will read everything sent in
that packet, including any other variables that were sent after that
string.  And just because you use WS1.SendData Message, doesn't mean
that only that message is being sent.  If you are sending anything
else after that, it may send just the message or it may send a larger
packet with the rest of the data.  It has been my experience that
there is no way to control when and how the actual packets are sent
over the network.  In the winsock programming I have done I have
always sent the length of any string first, then the string.

Server side:
dim Message as String
Message = "Hello World"
WS1.SendData Len(Message)
WS1.SendData Message

Client side:
Dim len as Integer, str as String
WS1.GetData len, vbInteger
WS1.GetData str, vbInteger, len

Quote:

>Ok. This has kept me baffled for 3 days now.

>I have and Standard EXE which has a Control Array of Winsock Controls.
>I pass Winsock Objects ByRef to a ActiveX DLL.

>The following Code works perfectly inside the dll.
>(I'll be referring to the Winsock as WS1)

>WS1.SendData "Hello World"

>In this case the client receives the message correctly.

>However. When I am attempting to pass a String Variable containing the
>message....

>dim Message as String
>Message = "Hello World"
>WS1.SendData Message

>The message is garbled when received by the client.

>I can't seem to determine the type of the data the client is receiving,
>and I'm tempted to think the problem has something to do with the
>marshalling between the processes, but haven't been able to determine a
>solution.

>Anyone care to comment on any of this?

>Frank.

>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.



Tue, 13 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. winsock senddata problem/question

2. VB6: Winsock senddata problem - help!

3. Visual Basic Winsock senddata problem

4. WInsock SendData problem HELP

5. Winsock SendData problems

6. Winsock SendData Problem?

7. Winsock SendData problem

8. Winsock SendData Problem

9. Winsock SendData problems

10. Winsock SendData Problem?

11. Winsock senddata problem!

12. Easy winsock.senddata problem

 

 
Powered by phpBB® Forum Software