<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[WinAPI namedPipes]]></title><description><![CDATA[<p>Hallo ich beschäftige mich gerade mit namedPipes und da mein Englisch nicht gerade das Beste ist hab ich einige Fragen dazu.</p>
<p>Ich habe mal angefangen eine NamedPipe zu erstellen.</p>
<pre><code>HANDLE hPipe;
  if (GetLastError() != ERROR_PIPE_BUSY)
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  if (!WaitNamedPipe(lpszPipename, 20000))
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  TCHAR write[BUFSIZE];
  write[0]=0;
  write[1]=1;
  write[2]=2;
  write[3]=3;
  write[4]=4;
DWORD cbWritten;
DWORD dwMode = PIPE_READMODE_MESSAGE;
  fSuccess = SetNamedPipeHandleState(hPipe,&amp;dwMode,NULL,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;SetNamedPipeHandleState failed&quot;&lt;&lt;endl;
    return -6;
  }
  // Send a message to the pipe server.
  fSuccess = WriteFile(hPipe,block,sizeof(block),&amp;cbWritten,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;WriteFile failed&quot;&lt;&lt;endl;
    return -5;
   }

  FlushFileBuffers(hPipe);
  DisconnectNamedPipe(hPipe);
  CloseHandle(hPipe);
</code></pre>
<p>aber hier scheitere ich schon da er nicht connecten kann. So simpel das Beispiel auch ist. Das Beispiel in der msdn ist einfach ein wenig komplex um es auf Anhieb zu kapieren im Forum bisher auch nichts konkretes gefunden.</p>
<p>Vielen Dank im vorraus schonmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/223471/winapi-namedpipes</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 07:11:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/223471.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 26 Sep 2008 10:34:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WinAPI namedPipes on Fri, 26 Sep 2008 10:34:50 GMT]]></title><description><![CDATA[<p>Hallo ich beschäftige mich gerade mit namedPipes und da mein Englisch nicht gerade das Beste ist hab ich einige Fragen dazu.</p>
<p>Ich habe mal angefangen eine NamedPipe zu erstellen.</p>
<pre><code>HANDLE hPipe;
  if (GetLastError() != ERROR_PIPE_BUSY)
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  if (!WaitNamedPipe(lpszPipename, 20000))
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  TCHAR write[BUFSIZE];
  write[0]=0;
  write[1]=1;
  write[2]=2;
  write[3]=3;
  write[4]=4;
DWORD cbWritten;
DWORD dwMode = PIPE_READMODE_MESSAGE;
  fSuccess = SetNamedPipeHandleState(hPipe,&amp;dwMode,NULL,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;SetNamedPipeHandleState failed&quot;&lt;&lt;endl;
    return -6;
  }
  // Send a message to the pipe server.
  fSuccess = WriteFile(hPipe,block,sizeof(block),&amp;cbWritten,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;WriteFile failed&quot;&lt;&lt;endl;
    return -5;
   }

  FlushFileBuffers(hPipe);
  DisconnectNamedPipe(hPipe);
  CloseHandle(hPipe);
</code></pre>
<p>aber hier scheitere ich schon da er nicht connecten kann. So simpel das Beispiel auch ist. Das Beispiel in der msdn ist einfach ein wenig komplex um es auf Anhieb zu kapieren im Forum bisher auch nichts konkretes gefunden.</p>
<p>Vielen Dank im vorraus schonmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1588381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1588381</guid><dc:creator><![CDATA[Schueler]]></dc:creator><pubDate>Fri, 26 Sep 2008 10:34:50 GMT</pubDate></item><item><title><![CDATA[Reply to WinAPI namedPipes on Fri, 26 Sep 2008 10:58:53 GMT]]></title><description><![CDATA[<blockquote>
<p>aber hier scheitere ich schon da er nicht connecten kann. So simpel das Beispiel auch ist. Das Beispiel in der msdn ist einfach ein wenig komplex um es auf Anhieb zu kapieren im Forum bisher auch nichts konkretes gefunden.</p>
</blockquote>
<p>Dein Fehlerbeschrieb ist sehr mager.<br />
Du sagst. dass connected nicht geht, aber der relevante Code zeigst Du nicht.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> Besser beschreiben, Fehlermeldungen etc. zeigen, relevanten Code zeigen.</p>
<p>Simon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1588388</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1588388</guid><dc:creator><![CDATA[simon.gysi]]></dc:creator><pubDate>Fri, 26 Sep 2008 10:58:53 GMT</pubDate></item><item><title><![CDATA[Reply to WinAPI namedPipes on Fri, 26 Sep 2008 11:11:02 GMT]]></title><description><![CDATA[<p>sry ich hatte zwar zwei Codes gechickt aber scheint irgendwas schief gegangen sein.</p>
<p>das ist der Client</p>
<pre><code>hPipe = CreateFile(lpszPipename,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
HANDLE hPipe;
  if (GetLastError() != ERROR_PIPE_BUSY)
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  if (!WaitNamedPipe(lpszPipename, 20000))
  {
    cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl;
  }
  TCHAR write[BUFSIZE];
  write[0]=0;
  write[1]=1;
  write[2]=2;
  write[3]=3;
  write[4]=4;
DWORD cbWritten;
DWORD dwMode = PIPE_READMODE_MESSAGE;
  fSuccess = SetNamedPipeHandleState(hPipe,&amp;dwMode,NULL,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;SetNamedPipeHandleState failed&quot;&lt;&lt;endl;
    return -6;
  }
  // Send a message to the pipe server.
  fSuccess = WriteFile(hPipe,block,sizeof(block),&amp;cbWritten,NULL);
  if (!fSuccess)
  {
    cout&lt;&lt;&quot;WriteFile failed&quot;&lt;&lt;endl;
    return -5;
   }

  FlushFileBuffers(hPipe);
  DisconnectNamedPipe(hPipe);
  CloseHandle(hPipe);
</code></pre>
<p>das ist der server</p>
<pre><code>HANDLE hPipe;

   hPipe = CreateNamedPipe(lpszPipename,PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
                             PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE | PIPE_WAIT,PIPE_UNLIMITED_INSTANCES,
                             BUFSIZE*sizeof(TCHAR),BUFSIZE*sizeof(TCHAR),5000,NULL);

   if (hPipe == INVALID_HANDLE_VALUE)
   {
     cout&lt;&lt;&quot;CreatePipe failed&quot;&lt;&lt;endl;
   }
</code></pre>
<p>so hoffe nun funktioniert es.<br />
Und zwar geht er bei mir bei dem ersten cout&lt;&lt;&quot;Could not open pipe&quot;&lt;&lt;endl; raus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1588394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1588394</guid><dc:creator><![CDATA[schueler]]></dc:creator><pubDate>Fri, 26 Sep 2008 11:11:02 GMT</pubDate></item></channel></rss>