Creating NamedPipes
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Creating NamedPipes

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Posts
    3

    Creating NamedPipes

    Hello Everybody,

    I have a Win32 Server Program which creates many pipes.I know that, name of the pipe will be having a standard format and cannot be changed.Pipe name creation will be as follows,

    LPTSTR lpszPipename = TEXT(\\\\.\\pipe\\SamplePipe);

    hPipe = CreateNamedPipe(lpszPipename, PIPE_ACCESS_DUPLEX,PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,BUFSIZE, BUFSIZE,0,NULL);

    Now my question is, can we create a named pipe dynamically, means creating a pipe during run time.

    Hope my qustion is somewhat clear.

    Shiva..

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,352

    Re: Creating NamedPipes

    Quote Originally Posted by sivalingam.m View Post
    Code:
    LPTSTR lpszPipename = TEXT(\\\\.\\pipe\\SamplePipe);
    
    hPipe = CreateNamedPipe(lpszPipename, PIPE_ACCESS_DUPLEX,PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,BUFSIZE, BUFSIZE,0,NULL);
    Now my question is, can we create a named pipe dynamically, means creating a pipe during run time.
    The code you showed does exactly what you asked: it creates (or, at least, tries to create) a named pipe during run time.

    BTW, I don't know a way to create a named pipe before run time (in design time) nor after the run time.
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,957

    Re: Creating NamedPipes

    Quote Originally Posted by sivalingam.m View Post
    I know that, name of the pipe will be having a standard format and cannot be changed.
    That's new to me. The name of the pipe can be changed alright once both server and client sides agree on new name.

    Now my question is, can we create a named pipe dynamically, means creating a pipe during run time.

    Hope my qustion is somewhat clear.
    No your question is not. Actually the code you quoted already is dynamic pipe creation. So what made you think it's not dynamic? or it's not a creation?
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center