Such as the program runs after a process has been testing whether the network connection, when the network connection is detected after stop testing, and one of another CPP was written by the original "network not connected" changes into "network connected
"
How to implement this function,
First thanks for your brothers
CodePudding user response:
Open a thread of judgmentCodePudding user response:
Upstairs, the elder brothers can detailed, I am a novice, don't know much about itCodePudding user response:
AfxBeginThread start new threads, thread to determine whether a socket is normal, abnormal when sending a message to another windowCodePudding user response:
//AfxbeginThread create a thread, the thread has been testing connection arrives, arrival notice UI updates, and exit the threads,CodePudding user response:
In functional design, program structure is divided into: master, communications and other modules, each module belong to different threads, through the custom message communication between modules, connection after the completion of the communication module, sending a message to the master, master can be connection status display processing,CodePudding user response:
Use of heartbeat packets,CodePudding user response:
Thanks for brother's answer, I first baidu AfxbeginThread, for example, see can solve,CodePudding user response:
Thread this thing, is to develop desktop web applications,CodePudding user response:
AfxbeginThread should add in where, how to detect whether the network connection, how to notify another CPP words ah, a little dizzyCodePudding user response:
Do you have any brothers can give one example, really don't know where should be addedCodePudding user response:
Network connection is successful or disconnect system will automatically give event messages, as long as the handling of the incident, what need to use a "process" to monitor? On receipt of the connection is successful message event processing, display the connection is successful, I set up the connection is successful in the program that is successful, notify the main program in the interface display "equipment connected" :
if(! M_ClientSocket - & gt; The Connect (m_defaultIP m_defaultPort))//connection specified address, port
{
//client connection failure
SocketReset ();//release the allocated space, subroutine emptied m_Connect string
//to reconnect, reset the state machine
M_netState=S0;
NetCommState (ev_conn);
}
The else
{
//the connection is successful, create traffic
M_file=new CSocketFile (m_ClientSocket);
//the connection is successful, inform the master control program
NetCommState (ev_conn_ok);
}
CodePudding user response:
Haven't on BBS, this feature also hasn't been implemented, today I try againCodePudding user response:
Which Internet connection do you mean with a computer to connect? Lower right corner of the screen or the "without a network connection" icon? What kind of situation, each has different solutionsCodePudding user response:
The