Click here to Skip to main content
15,896,730 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: assert... Pin
Anand Vivek Srivastava8-Sep-06 5:42
Anand Vivek Srivastava8-Sep-06 5:42 
AnswerRe: assert... Pin
John M. Drescher8-Sep-06 5:48
John M. Drescher8-Sep-06 5:48 
GeneralRe: assert... Pin
Zac Howland8-Sep-06 6:40
Zac Howland8-Sep-06 6:40 
QuestionCImage Pin
messages8-Sep-06 3:56
messages8-Sep-06 3:56 
AnswerRe: CImage Pin
Christopher Stratmann8-Sep-06 4:17
Christopher Stratmann8-Sep-06 4:17 
GeneralRe: CImage Pin
messages8-Sep-06 4:27
messages8-Sep-06 4:27 
GeneralRe: CImage Pin
Christopher Stratmann8-Sep-06 5:54
Christopher Stratmann8-Sep-06 5:54 
QuestionNamed Pipes buffer problem (Win32) Pin
vga28-Sep-06 2:53
vga28-Sep-06 2:53 
Hello

I have a problem which is difficult to explain, because I do not understand why it occurs.

Here is what I do:

* create a named pipe (server end) with CreateNamedPipe
* create a named pipe (client end) with CreateFile and SetNamedPipeHandleState

I use the same buffer size in both ends of the pipe

server end:
I specify PIPE_NOWAIT as 3rd argument to CreateNamedPipe
I specify PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE as 2nd argument to CreateNamedPipe

client end:
in CreateFile I set GENERIC_READ | GENERIC_WRITE

and set pipe mode to PIPE_NOWAIT | PIPE_READMODE_BYTE using SetNamedPipeHandleState


Then I sync. the 2 processes, when the client has connected to the server, I intend to write a series of bytes to the client end of the pipe using WriteFile

The code I am describing is working as a dream on 2 different windows XP machines, and 3 different windows 2000 machines, as long as I write no more than buffer_size bytes per write.


but on one particular windows 2000 server, WriteFile returns 1 (which means success), but bytes written is set to 0.

the client can read all day if he wants and still only get 0 bytes.

After a lot of debugging and testing, I figured out, on this particular windows 2000 server, if I write buffer_size - 24 bytes, the WriteFile returns 1 (success) and bytesWritten = the number of bytes I requested.

but it always has to be 24 bytes less than the actual buffer I specified in the CreateNamedPipe function. I do not understand why.

Does anyone have an explanation or theory for me?

Cheers.



AnswerRe: Named Pipes buffer problem (Win32) Pin
Richard Andrew x648-Sep-06 19:48
professionalRichard Andrew x648-Sep-06 19:48 
GeneralRe: Named Pipes buffer problem (Win32) Pin
vga210-Sep-06 22:36
vga210-Sep-06 22:36 
QuestionRPC Authentication won't work Pin
Mr.Brainley8-Sep-06 2:13
Mr.Brainley8-Sep-06 2:13 
AnswerRe: RPC Authentication won't work Pin
Programm3r8-Sep-06 2:20
Programm3r8-Sep-06 2:20 
GeneralRe: RPC Authentication won't work Pin
Mr.Brainley8-Sep-06 2:39
Mr.Brainley8-Sep-06 2:39 
GeneralRe: RPC Authentication won't work Pin
Programm3r8-Sep-06 2:43
Programm3r8-Sep-06 2:43 
Questionerror C2248: cannot access protected member declared in class 'CEmployee' Pin
jon-808-Sep-06 1:51
professionaljon-808-Sep-06 1:51 
AnswerRe: error C2248: cannot access protected member declared in class 'CEmployee' Pin
prasad_som8-Sep-06 2:04
prasad_som8-Sep-06 2:04 
AnswerRe: error C2248: cannot access protected member declared in class 'CEmployee' Pin
David Crow8-Sep-06 3:18
David Crow8-Sep-06 3:18 
AnswerRe: error C2248: cannot access protected member declared in class 'CEmployee' Pin
Zac Howland8-Sep-06 4:12
Zac Howland8-Sep-06 4:12 
QuestionShow character from number? [modified] Pin
bosfan8-Sep-06 1:39
bosfan8-Sep-06 1:39 
QuestionRe: Show character from number? [modified] Pin
prasad_som8-Sep-06 2:15
prasad_som8-Sep-06 2:15 
AnswerRe: Show character from number? Pin
bosfan8-Sep-06 3:53
bosfan8-Sep-06 3:53 
GeneralRe: Show character from number? Pin
prasad_som8-Sep-06 5:34
prasad_som8-Sep-06 5:34 
Questioncheckbox selection Pin
_tasleem8-Sep-06 1:05
_tasleem8-Sep-06 1:05 
AnswerRe: checkbox selection Pin
Hamid_RT8-Sep-06 1:11
Hamid_RT8-Sep-06 1:11 
GeneralRe: checkbox selection Pin
_tasleem8-Sep-06 1:28
_tasleem8-Sep-06 1:28 

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.