p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 5th, 2003, 09:08 AM
Friend of Wrox
Points: 619, Level: 9
Points: 619, Level: 9 Points: 619, Level: 9 Points: 619, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Cardiff, , United Kingdom.
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old December 8th, 2003, 10:07 AM
Authorized User
Points: 130, Level: 2
Points: 130, Level: 2 Points: 130, Level: 2 Points: 130, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Great Dunmow, Essex, United Kingdom.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old December 9th, 2003, 08:12 PM
Friend of Wrox
Points: 1,254, Level: 14
Points: 1,254, Level: 14 Points: 1,254, Level: 14 Points: 1,254, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ZModem over TCP/IP geogomez Pro VB 6 4 December 27th, 2007 03:59 AM
another tcp/ip related query watashi C# 2005 0 August 30th, 2007 08:31 PM
Serial to tcp/ip watashi C# 2005 1 August 28th, 2007 02:48 AM
tcp\ip communication in asp.net 1.1 Pramods BOOK: Beginning ASP.NET 1.0 0 July 16th, 2007 04:51 AM
TCP/IP HELP jpsultana VB.NET 2002/2003 Basics 0 September 29th, 2005 02:37 PM



All times are GMT -4. The time now is 02:10 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc