[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DataArrival event not firing in Winsock control

Posted on 2004-10-08
3
Medium Priority
?
749 Views
Last Modified: 2013-11-13
I have a program that receives datagrams and displays the contents to a flexgrid and/or a text file.  For the most part, when data arrives the DataArrival event for the winsock control does its job and thus the flexgrid and/or file gets updated.

However, after running the program for a while the flexgrid no longer gets updated.  Data is still being sent to my program however (I can check this with a network sniffer), but it seems that the DataArrival event is not firing.  If I click on a completely unrelated section of my GUI that brings up a popup window prompting me I have to do something else, and I click the 'ok' button, then lo and behold all (or most?) of the data that I've been expecting gets updated on the flexgrid and/or file.  After this occurs the program runs ok for a while, but it is inevitable that this problem will occur again.  The time interval at which this problem occurs is completely and utterly random.  It can occur a second after I start receiving data or maybe even a minute afterwards.

It almost seems that the DataArrival event has to be reminded every now and then what it is supposed to be doing by firing off a different, completely unrelated event.

Other notes:
- No errors occur when the flexgrid/file fails to immediately be updated.  the program just seems to be waiting for something to happen, but in the background it seems the receive buffer is still filling up because when I cause a completely unrelated event to occur, the dataArrival event will then behave properly and the backlog of data will be displayed.

- I am making sure that I receive all the data on a DataArrival event by utilising the number of bytes received (I noticed a MS article that said if the whole socket buffer was not emptied then the dataArrival event may not fire).

- I'm receiving data at quite a quick pace; every 30ms or so.  However, CPU usage hovers around 3 or 4%.
0
Comment
Question by:daecks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 2000 total points
ID: 12267361
Use DoEvents. Your program doesn't get enough time to update the GUI.
0
 

Author Comment

by:daecks
ID: 12277384
Thanks Ranjeet :-)
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 12277538
You're welcome :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question