Solved

get network interrupt

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 49
wait notify demo infinite loop 3 121
MaxSpan challenge 9 104
Line meaning 9 87
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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