![]() |
|
![]() | ||
|
Subject:
Visual Basic Winsock Programming Question
Category: Computers Asked by: plop-ga List Price: $10.00 |
Posted:
11 Mar 2003 02:20 PST
Expires: 10 Apr 2003 03:20 PDT Question ID: 174560 |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: Visual Basic Winsock Programming Question
From: maxhodges-ga on 11 Mar 2003 03:16 PST |
of course contact your vendor. maybe this is a known issue. |
Subject:
Re: Visual Basic Winsock Programming Question
From: br-ga on 11 Mar 2003 07:13 PST |
There is an easy solution The messages are probably sent together with a vbCrLf after the first Chr(13) and Chr(10) -- which is basically the windows return character. Extract the messages, using Mid, Left, and Right depending on how many messages are in one stream. Shouldn't be too hard to code once you figure out the character(s) which are separating the messages! Good luck! |
Subject:
Re: Visual Basic Winsock Programming Question
From: jeremyhuffman-ga on 15 Mar 2003 17:51 PST |
When the server sends multiple messages to the single client at the same time, is it sending them using the same instance of the socket? If so, then there is probably not a way for the client to distinguish between the two separate processes. What you need to do is synchronize responses for each client - that is make it so that only one message is sent to each client at a time, while continuing to asynchronously serve your other clients. This is possible without impacting performance. Visual Basic 6 doesn't directly support synchronizing code - for instance it does not offer a synchronize keyword like Java does. What you can do is use the Win32 mutex API to perform the synchronization yourself. Basically you name your mutex something meaningful for that client connection (maybe the port you speak to it on) - if you successfully lock the mutex then you proceed onwards with your message - otherwise you loop, sleep and try to lock the mutex until you succeed. This is the basic technique for resolving all synchronizing issues in all programming languages, but some languages make it easier than others. The basic API you will use is CreateMutex - I even found a google groups thread where its usage is discussed with a practical example. http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=1856c01c29590%247b333d20%248df82ecf%40TK2MSFTNGXA02&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dvb%2Bmutex |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |