Hi,
I’ve got a daemon written with juce using InterprocessConnection Class to create a Pipe.
My client, can’t use juce, so i’am trying to use native windows API to send messages to my daemon.
My client successfully connect to the daemon but when i send data, my daemon doesn’t receive anything.
What am i doing wrong ?
Here is my client code :
int main(int argc,char** argv){
cout << “Test pipe” << endl;
HANDLE hPipe;
DWORD dwWritten;
char *pszPipe = "\\\\.\\pipe\\midiauthpipe";
// Test if pipe exists
if ( WaitNamedPipe(pszPipe, 1000) == 0 ){
cout << "WaintNamePipe error : " << GetLastError() << endl;
}
// Create pipe handle
hPipe = CreateFile(pszPipe, GENERIC_READ | GENERIC_WRITE, 0, 0,OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
// Test handle validity
if (hPipe == INVALID_HANDLE_VALUE) {
cout << "invalid pipe handle" << endl;
exit(-1);
} else {
cout << "Pipe seems correctly opened" << endl;
}
// asynchrnous write
char huhu[512]="fzngfjnezjnzejgnzejgnzejnjgnzejgnejzungezgnjezgnzjgnzejnezjngjueznjngejzn";
WriteFile(hPipe, huhu, 512, &dwWritten, NULL);
// Cleaning
DisconnectNamedPipe(hPipe);
CloseHandle(hPipe);
}
Help me !!!
Thx.
Denis.
