Solved

get network interrupt

Posted on 2003-11-11
3
284 Views
Last Modified: 2013-11-20
I'm trying to make an application in VC++, for receiving and writting data through network (Socket). Receiving is already working, but it is working  so, that the application is running in endless while loop. But I would like to make it so, that I will activate receive function only when network controller will receive something. So something like interrupt.

How can I do this?

Thanks
0
Comment
Question by:sasabunetic
3 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 9723137
The BEST way to do this in Windows/MFC is to use the CAsyncSocket class.  When you derive a class of your own from CAsyncSocket you can override the OnReceive() handler which will then get called when you have incoming data.
0
 
LVL 5

Accepted Solution

by:
jrocnuck earned 50 total points
ID: 9725922
how about with select calls?

do a select in a separate thread on the read file descriptor, when the select returns if the code tells you there is something to be read, post a message back to your application telling your program to read.

Basically that's what the MFC socket class has built for you, but you have to be careful when using the MFC socket when it comes to multiple threads.

if you have a simple application with a simple socket, then MFC would be the easiest way to do this.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9764330
But select is not an "interrupt".
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now