|
Hamed Mosavi wrote: Is it my fault or it's a usual behavior?
No it's not your fault!. TCP protocol has been designed in such a way. Sometimes it really looks stupid. You can never know if the client is not alive at the other end when there's a n/w distruption occurs. It's done because, there may be flucuations in the n/w then and there if all these are reported as disconnect events, this would degrade TCP. So it abstracts the disconnections to the user. Still not completely sure why they dont do it!.Implement a "ping" like solution to your problem. The server sends "Are you there" periodically to the clients and the clients "must" reply to the question. If it doesn't then it's not there. In short you are making your own *protocol* to overcome this handicap in TCP.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Thanks
VuNic wrote: n short you are making your own *protocol* to overcome this handicap in TCP.
I just thought about that when said: "Is it good to continually(periodically is much better word here as you suggested) check connection in a thread?"
This will solve my problem, but this increase workload significantly if I wanted to connect a server to a large group of clients and also may increase expenses extensively. Doesn't it?
//This is not a signature
while (I'm_alive) {
cout<<"I Love Programming";
}
|
|
|
|
|
Hamed Mosavi wrote: check connection in a thread?"
Exactly. But you can still do it with timers but for console applications, threads would be prefered. Otherwise you need to implement callbacks& message loops.
Hamed Mosavi wrote: but this increase workload significantly
Yeah it certainly is an overhead. But I haven't seen any visible degradation in the system. We can do like this. You can maintain a data structure that keeps track of "last" response recieved from the clients. Rather than sending ping to all clients, you traverse thru the container(data structure that you maintain to keep track of client event times) and send ping request only to clients that has not sent any messages for so long. This way you can reduce the overhead.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Thank you very much. It was informative.
//This is not a signature
while (I'm_alive) {
cout<<"I Love Programming";
}
|
|
|
|
|
You are welcome Hamed
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Hamed Mosavi wrote: s it my fault or it's a usual behavior? How to recognize network failures if there is not an event available(On Disconnect doe's not work)? Is it good to continually check connection in a thread?
IsNetworkAlive
|
|
|
|
|
Great, But what if the computer is connected to multiple LANs simultaneously?
//This is not a signature
while (I'm_alive) {
cout<<"I Love Programming";
}
|
|
|
|
|
Hi,
You u can have ur application specific protocol, say keep alive protocol which will send heart beat or a dummy message after every pre - determined interval of time. If the send fails u can get the reason in GetLastError and determine if the client is still alive (connected to network )or down.
Get the facts or facts will get you and when you get them, get them right or they will get you wrong.
Happy Coding
|
|
|
|
|
Thanks to Mr. Vunic, this solution discussed already and solved.
Anyway, thank you again.
//This is not a signature
while (I'm_alive) {
cout<<"I Love Programming";
}
|
|
|
|
|
How can I retrieve a registry key path from HKEY (Key Handle) ?
|
|
|
|
|
RegQueryValueEx.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Thanks, but according to MSDN RegQueryValueEx: Retrieves the type and data for the specified value name associated with an open registry key.
and I need to retrieve the path of the key handle.
|
|
|
|
|
I think he has a handle and is going to find out which key, the handle, refers to, i.e. He wants to find the key that he opened already and has a handle to it.
//This is not a signature
while (I'm_alive) {
cout<<"I Love Programming";
}
|
|
|
|
|
|
bahaa123654 wrote: How can I retrieve a registry key path from HKEY (Key Handle) ?
CRegKey!
|
|
|
|
|
Hai,
This is a program for serial data reception. Can anybody tell me how this code is working. It is programmed to receive 18 bytes (a configured data packet of 18 bytes) of data.......
Code is:
CTimerDlg::OnOnComm()
{
if(m_comm.GetCommevent() == 2) // m_comm is serial member variable
{
UCHAR *parray; // local array
COleVariant var;
var = m_comm.GetInput();
long comL;
HRESULT hr = SafeAraayGetUBound(var.parray , 1 , &comL);
if(hr == S_OK)
{
hr = SafeArrayAccessData(var.parray , (void**)&parray);
if(hr == S_OK)
{
Rxdata[RxBuffcount++]=parray[0]; //local array
}
SafeArrayUnaccessData(var.parray);
if(RxBuffcount == 18) // if 18 bytes received proceed
{
Processdata(); // data processing
RxBuffcount = 0;
}
}
}
}
My questions are:
1. How is this code working.
2. Is this code receiving data bytewise or not .
3. If so how and where to check for the first (header) byte (say 0xaa).
Plz help me.
Regards,
Guddappa T H
|
|
|
|
|
where is Rxdata declared?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Guddappa T H wrote: 3. If so how and where to check for the first (header) byte (say 0xaa).
it is necessary to use this class or code
|
|
|
|
|
i need some advice on creating an application that looks'n feel like windows
explorer:
-one CTreeCtrl
-Below the CTreeCtrl an info region
-Below the info region, a status bar.
-Data displayed in CTreeCtrl are files and directories
pls help me i need it now
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
i have to use tree controls. pls explain me how to use this
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
thats ok i have to create wundows style explorer mfc application using tree list control. i need some idea for this. pls help me with a sample code
-- modified at 0:45 Monday 2nd April, 2007
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
By default you can create one sample application by clicking few clicks. I think it is easy and you already know about this. why you are still searching againg again? what exactly you need.
To develop explorer style app just do these steps.
-------------------------------------------------
Open Visual Studio . VC++ environment(It can be 6.0/7.x, I am telling steps in 7.x)
1) create new project.
2) Select project type is MFC application
3) Select over view -> nothing to select.
Application type -> Single Document.
Project Style -> Windows Explorer.
4) Click Finish button.
Here you will get One Tree View control. and One list view control in your project.
You can get what exactly you need. It is easy to use for you. Check MSDN for that. MSDN can be used by any one in online. ;P enjoy.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
hmm but i am using dilaogs not document. if i clicked a button it will show the tree control dialog. is there any way to do this in document
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|