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
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.