Solved

get network interrupt

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.

749 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