Public Member Functions

NamedPipe Class Reference

A cross-process pipe that can have data written to and read from it. More...

List of all members.

Public Member Functions

 NamedPipe ()
 Creates a NamedPipe.
 ~NamedPipe ()
 Destructor.
bool openExisting (const String &pipeName)
 Tries to open a pipe that already exists.
bool createNewPipe (const String &pipeName)
 Tries to create a new pipe.
void close ()
 Closes the pipe, if it's open.
bool isOpen () const
 True if the pipe is currently open.
String getName () const
 Returns the last name that was used to try to open this pipe.
int read (void *destBuffer, int maxBytesToRead, int timeOutMilliseconds=5000)
 Reads data from the pipe.
int write (const void *sourceBuffer, int numBytesToWrite, int timeOutMilliseconds=2000)
 Writes some data to the pipe.
void cancelPendingReads ()
 If any threads are currently blocked on a read operation, this tells them to abort.

Detailed Description

A cross-process pipe that can have data written to and read from it.

Two or more processes can use these for inter-process communication.

See also:
InterprocessConnection

Constructor & Destructor Documentation

NamedPipe::NamedPipe (  )

Creates a NamedPipe.

NamedPipe::~NamedPipe (  )

Destructor.


Member Function Documentation

bool NamedPipe::openExisting ( const String pipeName )

Tries to open a pipe that already exists.

Returns true if it succeeds.

bool NamedPipe::createNewPipe ( const String pipeName )

Tries to create a new pipe.

Returns true if it succeeds.

void NamedPipe::close (  )

Closes the pipe, if it's open.

bool NamedPipe::isOpen (  ) const

True if the pipe is currently open.

String NamedPipe::getName (  ) const

Returns the last name that was used to try to open this pipe.

int NamedPipe::read ( void *  destBuffer,
int  maxBytesToRead,
int  timeOutMilliseconds = 5000 
)

Reads data from the pipe.

This will block until another thread has written enough data into the pipe to fill the number of bytes specified, or until another thread calls the cancelPendingReads() method.

If the operation fails, it returns -1, otherwise, it will return the number of bytes read.

If timeOutMilliseconds is less than zero, it will wait indefinitely, otherwise this is a maximum timeout for reading from the pipe.

int NamedPipe::write ( const void *  sourceBuffer,
int  numBytesToWrite,
int  timeOutMilliseconds = 2000 
)

Writes some data to the pipe.

If the operation fails, it returns -1, otherwise, it will return the number of bytes written.

void NamedPipe::cancelPendingReads (  )

If any threads are currently blocked on a read operation, this tells them to abort.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines