What happens to a named pipe if server crashes?

IIRC the ReadFile or WriteFile function will return FALSE and GetLastError() will return STATUS_PIPE_DISCONNECTED I guess this kind of handling is implemented in your code, if not you should better add it ;-).

– Sneha Oct 10 '10 at 18:04 You close your handle to the pipe (client handle) and then try to re-connect.It then will either tell you Windows Error Code 2 (File not found) or if the server is started it will be able to reconnect. – Vinzenz Oct 10 '10 at 18:13 1 All your handles from the crashed applications are usually closed by the Operating system, the same is for unfreed memory by the crashing application. All memory and all handles which are not released by the application are released by the Operating System once the application quit.

There are few exceptions but those handles are not among them. – Vinzenz Oct 11 '10 at 16:37 1 Well you always can implement some forced test crashes in several locations and see if the behavior is as expected. Just that you can be on the secure side.It never hurts to verify such things yourself the amount you learn from this is immense believe me :-) – Vinzenz Oct 11 '10 at 16:49 1 @Sneha: it should take less than 30 minutes to start up the two applications watch some data go across and kill the server app with task manager to see what happens.

– Chris Lively Oct 11 '10 at 17:02.

I just want to throw this out there. If you want a survivable method for transferring data between two applications, you might consider using Mail Slots or even bringing in BizTalk or another message platform. There are several things to consider: what happens if the server is rebooted or loses power?

What happens if the server application becomes unresponsive? What happens if the server application is killed or goes away completely? What is the appropriate response of a client application in each of the above?

Each of those contexts represent a potential loss of data. If the data loss is unacceptable then named pipes is not the mechanism you should be using. Instead you need to persist the messages somehow.

Mail Slots, storing to a database, or even leveraging Biztalk can take care of the survivability of the message itself. If 1 or 3 happens, then the named pipe goes away and must be recreated by a new instance of your server application. If #2 happens, then the pipe won't go away until someone either reboots the server or kills the server app and starts it again.

Regardless, the client application needs to handle the above issues. They boil down to connection failed problems. Depending on what the client does you might have it move into a wait state and let it ping the server every so often to see if it has come back again.

Without knowing the nature of the data and communication processes involved its hard to recommend a proper approach.

To a named pipe is happened by (without quotes):. What happens to a named pipe.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions