Click to See Complete Forum and Search --> : Winsock - control problem: Missing DATAARRIVAL - events


Watz
March 31st, 1999, 12:16 PM
Hi there !


Perhaps some you you have experienced a similar problem:


I wrote a little VB-program allowing me to map multiple TCP-Connections

on a single port to another server on a specific port.


The program works just fine, the problem is that when

transferring *many* data, especially when mapping several

connections (which means 2 Winsock Controls per connection, one for

the outgoing and one for the incoming) Visual Basic seems

to "miss" some DATAARRIVAL - events. Data on the outgoing or

on the incoming connection seems to get lost.


When debugging the app with a breakpoint in the DATAARRIVAL - event

everything works perfectly. Slow connections like modem or ISDN-links

also work without any problem.


But LAN - mappings with file-transfers do loose data.


Perhaps YOU can prevent me from going to VC++ and native Winsock-API :-)


many thanks in advance,


Watz

Gordito Supreme
April 5th, 1999, 10:37 AM
I had a similar problem with a Winsock Control I created. When data comes in I assume you are sending it to a function to have some operation performed on it. In my program it seemed like I wasn't getting data in, but what I think was happening is that data came in but the program couldn't do anything with it ... because the variable used to hold it was being used by a function (from the previous input) because in VB the default handling is to send a variable to a function by reference. So what I did in the data in module is to send all the data to the appropriate processing function by value (ByVal). This fixed the problem.

Gordito Supreme

CraigF
July 14th, 1999, 03:16 PM
Sometimes when sending a large amount through Winsock controls, you need to put a pause time in to allow either end to process the data sent or received.

You need to make sure that what is sent is processed before ramming more down the connection. I had the same problem, and with slower modems and connections, the problem went away. This is because WinSuck gets a little overloaded - or so I have been told.

Regards,
Craig.

Gorditos
July 15th, 1999, 06:38 PM
I've tried the Microsuck WinSock control for a couple apps and it apparently is not a very reliable tool. However, I have found the MFC socket class CSocket, to be easy to work with and quite reliable, and have used it to make a custom socket control. If you are not up to that task, a couple good 3rd party socket controls are IP Works and Dolphin socket. Cresent Wrench is also supposed to be good but I like the forementioned controls better.

Gordito

April 7th, 2000, 08:17 AM
I have the same problem I'm as 2nd year network student and as project I
am making a simple poontoon 21 game I spent nearly 1 whole month on
that problem

microsoft shouldn't be alowed to release defunct code as a commercal product

Tirisfal
April 7th, 2000, 09:20 AM
The VB winsock control seems to do some strange things with the DataArrival event.

It does not always call the event with every received packet, instead opting to mash several packets together into one larger string before firing the event, thus forcing you to manually separate the data. Check to see if your data is arriving combined with other packets in a single DataArrival event.

Also check that your packets do not exceed 4096 bytes. If at any point they do, the control self destructs and trashes ALL your packets from that point on.

Of course, like the other people who have responded have said, the Winsock control isn't particularly reliable as a whole, and tends to get overloaded.

Hope this helps
--Tirisfal

ramesh_nittur
October 19th, 2000, 01:04 PM
Hi,

I am using CSocket for transfering data.Since my data is more than 8k(tcp header size),i split it into chunks of 4k and sending it through series of Send in a for loop.

The problem is the data send through 1st send is overlapping with subsequent Send.Please suggest me some ways in MFC CSOcket in which i can check the data send through 1st send is complete and it has cleared the buffer(i am assuming it to be buffered I/O) before going for the next Send.

Thanks in advance,