Click here to Skip to main content
15,907,497 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to recognize : an other computer (in Lan) has pasted a file to my Directory? Pin
ngocdq20-Jun-04 18:32
ngocdq20-Jun-04 18:32 
QuestionGame output? Pin
Lem35718-Jun-04 15:02
Lem35718-Jun-04 15:02 
AnswerRe: Game output? Pin
Ghazi H. Wadi19-Jun-04 1:40
Ghazi H. Wadi19-Jun-04 1:40 
Questionmenu problem ? Pin
kendao18-Jun-04 14:38
kendao18-Jun-04 14:38 
AnswerRe: menu problem ? Pin
Weiye Chen18-Jun-04 15:53
Weiye Chen18-Jun-04 15:53 
Questionappearance problem ? Pin
kendao18-Jun-04 14:25
kendao18-Jun-04 14:25 
AnswerRe: appearance problem ? Pin
Michael Dunn18-Jun-04 16:36
sitebuilderMichael Dunn18-Jun-04 16:36 
Generalpipe message Pin
Anonymous18-Jun-04 11:39
Anonymous18-Jun-04 11:39 
Hello I'm writing client/server program, I use pipe message to communicate between client and server.
Here is my question.
A server supposes to listen to clients.
So I CreateNamedPipe(), then write the pipe name ""\\\\.\\pipe\\servername" into a text file.
Then called
ConnectNamedPipe(hPipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED)

The Client get the string from a text file, then starts to talk to Server by calling CreateFile(), in Server program ConnectNamedPipe() doesn't return until the client get connected (it is true for very first client. I'll explain more later). After the conversation is done, the client closes the pipe, Server call ConnectNamedPipe() again to see whether another client is talking.

server
CreateNamePipe()<br />
while(1)<br />
{<br />
fSuccess = ConnectNamedPipe(hPipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED)if(failed)<br />
if (! fSuccess || cbBytesRead == 0) <br />
   break;<br />
do conversation,<br />
}<br />
FlushFileBuffers(hPipe); <br />
DisconnectNamedPipe(hPipe); <br />
CloseHandle(hPipe); <br />


When the server call ConnectNamedPipe second time, fSuccess is always failed and close the pipe. How can Server keeps the pipe open until one of the client said, finished all the job.

When the Server is executing ConnectNamePipe, and there is no client talking to him, All the server GUI are died. I cannot click on the button to tells the client to stop waiting if there is no body is talking to him and stay idle.
Is there message handler for a pipe?

Thank you.
Generalget windows 2000 domain user password hash Pin
mkrelli18-Jun-04 11:18
mkrelli18-Jun-04 11:18 
GeneralRe: get windows 2000 domain user password hash Pin
gamitech18-Jun-04 11:22
gamitech18-Jun-04 11:22 
GeneralRe: get windows 2000 domain user password hash Pin
mkrelli19-Jun-04 10:46
mkrelli19-Jun-04 10:46 
GeneralProject building .exp and .lib files for no apparent reason Pin
IGx8918-Jun-04 11:07
IGx8918-Jun-04 11:07 
GeneralRe: Project building .exp and .lib files for no apparent reason Pin
Johan Rosengren19-Jun-04 7:41
Johan Rosengren19-Jun-04 7:41 
GeneralRe: Project building .exp and .lib files for no apparent reason Pin
IGx8921-Jun-04 13:16
IGx8921-Jun-04 13:16 
GeneralHelp With App Licenses Pin
IrishSonic18-Jun-04 10:16
IrishSonic18-Jun-04 10:16 
GeneralRe: Help With App Licenses Pin
JimmyRopes10-Sep-04 16:33
professionalJimmyRopes10-Sep-04 16:33 
GeneralCFileDialog whata f...??? hehehee Pin
Nitro_gen18-Jun-04 10:09
Nitro_gen18-Jun-04 10:09 
GeneralRe: CFileDialog whata f...??? hehehee Pin
Johan Rosengren19-Jun-04 20:26
Johan Rosengren19-Jun-04 20:26 
GeneralRe: CFileDialog whata f...??? hehehee Pin
Nitro_gen23-Jun-04 9:42
Nitro_gen23-Jun-04 9:42 
GeneralGetting Time (milliseconds)m of Seconds Pin
Grahamfff18-Jun-04 10:07
Grahamfff18-Jun-04 10:07 
GeneralRe: Getting Time (milliseconds)m of Seconds Pin
John R. Shaw18-Jun-04 11:12
John R. Shaw18-Jun-04 11:12 
GeneralRe: Getting Time (milliseconds)m of Seconds Pin
gamitech18-Jun-04 11:15
gamitech18-Jun-04 11:15 
GeneralRe: Getting Time (milliseconds)m of Seconds Pin
Nick Parker18-Jun-04 11:34
protectorNick Parker18-Jun-04 11:34 
GeneralRe: Getting Time (milliseconds)m of Seconds Pin
James R. Twine18-Jun-04 11:37
James R. Twine18-Jun-04 11:37 
GeneralRe: Getting Time (milliseconds)m of Seconds Pin
Grahamfff19-Jun-04 10:51
Grahamfff19-Jun-04 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.