## NAME

ACE_UPIPE_Stream - Defines the method that transfer data on a UPIPE.

## SYNOPSIS

    #include <ace/UPIPE_Stream.h>

    class ACE_UPIPE_Stream : public ACE_SPIPE
    {
      public:
        friend class ACE_UPIPE_Acceptor;
        friend class ACE_UPIPE_Connector;
        ACE_UPIPE_Stream (void);
        virtual ~ACE_UPIPE_Stream (void);
        int close (void);
        ACE_HANDLE get_handle (void) const;
        int send (ACE_Message_Block *mb_p, ACE_Time_Value *timeout = 0);
        int recv (ACE_Message_Block *&mb_p, ACE_Time_Value *timeout = 0);
        int send (
            const char *buffer,
            size_t n,
            ACE_Time_Value *timeout = 0
            );
        int recv (char *buffer, size_t n, ACE_Time_Value *timeout = 0);
        int send_n (
            const char *buffer,
            size_t n,
            ACE_Time_Value *timeout = 0
            );
        int recv_n (char *buffer, size_t n, ACE_Time_Value *timeout = 0);
        int control (int cmd, void *val) const;
        int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const;
        void dump (void) const;
        ACE_ALLOC_HOOK_DECLARE;
      private:
        ACE_Message_Block *mb_last_;
        size_t remaining_;
        ACE_UPIPE_Addr remote_addr_;
        MT_Stream stream_;
        int reference_count_;
        ACE_Thread_Mutex lock_;
    };

## Initialization and Termination.

    ACE_UPIPE_Stream (void);

    virtual ~ACE_UPIPE_Stream (void);

    int close (void);

Shut down the UPIPE and release resources.

    ACE_HANDLE get_handle (void) const;

Return the underlying I/O handle.

## Send/recv ACE Message_Blocks.

    int send (ACE_Message_Block *mb_p, ACE_Time_Value *timeout = 0);

Send a message through the message queue. Returns -1 on error, else 0.

    int recv (ACE_Message_Block *&mb_p, ACE_Time_Value *timeout = 0);

Recv a message from the message queue. Returns -1 on error, else 0.

## Send/recv char buffers.

    int send (const char *buffer, size_t n, ACE_Time_Value *timeout = 0);

Send a buffer of `n` bytes through the message queue. Returns -1 on error, else number of bytes sent.

    int recv (char *buffer, size_t n, ACE_Time_Value *timeout = 0);

Recv a buffer of upto `n` bytes from the message queue. Returns -1 on error, else number of bytes read.

    int send_n (
        const char *buffer,
        size_t n,
        ACE_Time_Value *timeout = 0
        );

Send a buffer of exactly `n` bytes to the message queue. Returns -1 on error, else number of bytes written (which should == n).

    int recv_n (char *buffer, size_t n, ACE_Time_Value *timeout = 0);

Recv a buffer of exactly `n` bytes from the message queue. Returns -1 on error, else the number of bytes read.

    int control (int cmd, void *val) const;

Perform control operations on the UPIPE_Stream.

    int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const;

Return the remote address we are connected to.

    void dump (void) const;

Dump the state of an object.

    ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

## AUTHOR

Gerhard Lenzer and Douglas C. Schmidt

## LIBRARY

ace