Solved

get network interrupt

Posted on 2003-11-11
3
305 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rewrite URL With Encoded Characters 6 78
Excel Use VBA to get user's Mac Address for their computer 5 160
sumDigits challenge 9 147
substring method in java 1 118
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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