I wrote Socket programming which is running good, i want to know whether all the data is received properly by the server with out any loss from client side. Meaning i need acknowledge from server side. How can i do it?.
All IP-packets are sent with a CRC32 checksum that the receiver recalculates to validate the data. If the checksum is incorrect, the packet is discarded.
This happens regardless of what you do, it's how the IP-protocol works.
If you're using an UDP ports, the sender will never be informed whether the receiver got the packet or not, at any OSI level, since UDP traffic is connectionless.
If you're using TCP ports, the sender will be sent an ACK for each packet. Whether the packet is to be resent or not is depending on a configurable threshold in the registry found at HKEY_LOCAL_MACHINE/SYSTEM/currentcontrolset/services/tcpip/parameters.
This means that the sender cannot be informed if the receiver got a corrupt packet since the receiving application will never get the packet since it's been discarded.
I suggest you implement a small protocol of your own at the OSI application level that send ACKs to the sender's application. You will then be informed if the receiver never got the packet by the absence of an ACK.
Hope this helps
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
I have record a video avi, but some time I get a blank frame at first. I need to removethis but I don't know how to check if bitmap frame is blank or not. Please help me with checking for this.
Thanks in advance!
As developing an NT service I've come across a little problem that I'm no able to sort it out. The problem is as follows:
My service is running on local system account (as it is natural) and one of its chores is to launch a particular process in a particular session and with the privileges of a particular user(impersonation). I think I do everything I am supposed to:
- Retrieve environment block of the user.
- Retrieve access token of the user we try to impersonate.
- Convert the token into a primary one.
- Stablish the session for the token.
- Fill in STARTUPINFO structure with the window station and desktop information
-Finally I call CreateProcessAsUserW this way:
Well, the code I have in my service works perfectly well in any platform save for the case when I try to create a new process in a terminal session of windows 2003 Server (64 bits) where I get error code 6 (Handle not valid). Any suggestion? Thanks in advance.
Is this destruction of the Window and object the correct way to do it?
Destroys the Windows window attached to the CWnd object. The DestroyWindow member function sends appropriate messages to the window to deactivate it and remove the input focus. It also destroys the window’s menu, flushes the application queue, destroys outstanding timers, removes Clipboard ownership, and breaks the Clipboard-viewer chain if CWnd is at the top of the viewer chain. It sends WM_DESTROY and WM_NCDESTROY messages to the window. It does not destroy the CWnd object.
So whatever I am doing is correct. I have one question though. As you can see from my example above, I have created a cMainFrame Pointer to the CMainFrame class. Now, lets say that cMainFrame is a private data member of class A. So, it is a who is creating cMainFrame and calling cMainFrame->CreateWindow().
Now my question is, if a user closes the window from the close button on the Window Title bar, I would have to notify class A so that it may do the required cleaning up like delete cMainFrame and stuff. So, when do I notify A then the window is destroyed? Lets say, that I am notifying A during WM_DESTROY. The implementation in A would be as follows:
I am using the Win32API. No MFC. Could you tell me which Windows message is equivalent to CWnd::PostNcDestroy?
WM_NCDESTROY is the last message for a window.
The MFC implementation goes like this. MFC does some clean up in OnNcDestroy and then calls PostNcDestroy. The default implementation does nothing. So you will have to implement something like this.
From MSDN about PostNcDestroy:
The default implementation of CWnd::PostNcDestroy does nothing which is appropriate for window objects allocated on the stack frame or embedded in other objects. This is not appropriate for window objects that are designed to be allocated by themselves on the heap (not embedded in other C++ object).
Those classes that are designed to be allocated by themselves on the heap override the PostNcDestroy member function to perform a "delete this". This statement will free any C++ memory associated with the C++ object. Even though the default CWnd destructor calls DestroyWindow if m_hWnd is non-NULL, this does not lead to infinite recursion since the handle will be detached and NULL during the cleanup phase.