|
|
 |
| Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro VB 6 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

December 5th, 2003, 09:08 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Cardiff, , United Kingdom.
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
TCP/IP Data is Being Concatenated
I am writing software in a client/server environment and I am wanting to communicate with the server and all the other clients using TCP/IP via the VB Winsock control.
I have an app running (written by me in VB) on the server which accepts TCP/IP connections and data from several clients (also written in VB). The clients also accept data from the server (of course :)).
The problem is that most of the time it works without any problems. But sometimes 2 messages will be sent by the server in quick succession, and again usually this works fine and the client receives 2 distinct DataArrival events. Then every so often the 2 messages will be concatenated (not by my app, but by the OS I think) and the client only receives 1 DataArrival event with the data being both messages concatenated.
The only way to stop it doing this after the first time it happens is to restart the server (as in restart Win2K, not just my app). I have gone through my code and can not find anything wrong with it. I do a DoEvents before and after every Winsock.SendData but still the concatenation happens...sometimes.
I think that it only happens when I have more than one client connected to my server app, but I can not guarantee that.
Has anyone else experienced this type of problem, and if so were you able to fix it and how?
I know I could change the way it works and look for an end of message flag and split it at the client, but I would prefer not change my code that much.
Regards
Owain Williams
__________________
Regards
Owain Williams
|

December 8th, 2003, 10:07 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Location: Great Dunmow, Essex, United Kingdom.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
NOt going to help much, but a similar thing happens sometimes when using MSCOMM with RS232. The only way I have found to ensure that all is ok, is to test for string length's and data types coming in., part of the problem can be to do with noise on the line.
|

December 9th, 2003, 08:12 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
As far as I know, winsock sends an event when there is data in the buffer, and then you can use the BytesReceived property to check how much data there is. I am not surprized if windows collapses events (and it is more efficient too)
Marco
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |