All Packages  This Package  Class Hierarchy  Class Search  Index

Class posix.MsgQ
java.lang.Object
   |
   +----posix.IPC
           |
           +----posix.MsgQ

  Summary

public class  MsgQ
     extends posix.IPC
{
          // Fields 1
     public static final int MSG_NOERROR;

          // Constructors 3
     public MsgQ(int);
     public MsgQ(int, int) throws IPCException;
     public MsgQ(String, int) throws IPCException;

          // Methods 8
     public static native int msgget(int, int);

     public IPC.Perm getPerm() throws IPCException;
     public MsgQ.msqid_ds getStatus() throws IPCException;
     public int recv(int[], byte[], int, int);
     public int recv(CPtr, int, int) throws IPCException;
     public void remove();
     public int send(int, byte[], int, int);
     public int send(CPtr, int, int) throws IPCException;

          // Inner Classes 1
     public static class MsgQ.msqid_ds
}

Represent a posix message queue.

Author:
Stuart D. Gathman Copyright (C) 1998 Business Management Systems, Inc.

This code is distributed under the GNU Library General Public License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.




  Fields

· MSG_NOERROR

Summary  |  Top

   public static final int MSG_NOERROR


  Constructors

· MsgQ

Summary  |  Top

   public MsgQ(int key, 
               int flag)  throws IPCException


· MsgQ

Summary  |  Top
   public MsgQ(int qid) 


· MsgQ

Summary  |  Top
   public MsgQ(String path, 
               int id)  throws IPCException

Attach to an existing message queue.



  Methods

· msgget

Summary  |  Top
   public static native int msgget(int key, 
                                   int flag) 


· send

Summary  |  Top
   public int send(int type, 
                   byte[] msg, 
                   int size, 
                   int flag) 

Send a message contained in a byte array.

Returns:
0 for success, -1 for failure


· recv

Summary  |  Top
   public int recv(int[] type, 
                   byte[] msg, 
                   int mtype, 
                   int flag) 

Receive a message in a byte array.

Parameter Description
mtype selects which messages to receive
type returns the mtype of the message received

Returns:
-1 for failure, or the number of bytes stored in the byte array.


· send

Summary  |  Top
   public int send(CPtr msg, 
                   int size, 
                   int flag)  throws IPCException

Send a message contained in a CPtr. This can be convenient when it is necessary to build C data structures in the message to interface with C code. Unlike the posix system call, the size is the actual size of the message - including the required mtype field as the first element.

Parameter Description
msg The message to send in native format.
size The message size including the type.
flag Options.

Returns:
0 for success, Errno.EAGAIN if queue full and IPC_NOWAIT option specified.


· recv

Summary  |  Top
   public int recv(CPtr msg, 
                   int type, 
                   int flag)  throws IPCException

Receive a message into a CPtr. This can be convenient when the message contains C data structures. Unlike the posix system call, the size returned is the actual message size including the required mtype field as the first element. If this call fails, the posix error code can be retrieved with the Errno class before any further I/O takes place in this Thread.

Returns:
-1 for failure, or the received message size


· remove

Summary  |  Top
   public void remove() 

Remove the message queue from the system.

Overrides:
remove in class IPC


· getStatus

Summary  |  Top
   public MsgQ.msqid_ds getStatus()  throws IPCException


· getPerm

Summary  |  Top
   public IPC.Perm getPerm()  throws IPCException
Overrides:
getPerm in class IPC


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7