nachos.network
Class PostOffice

java.lang.Object
  extended by nachos.network.PostOffice

public class PostOffice
extends Object

A collection of message queues, one for each local port. A PostOffice interacts directly with the network hardware. Because of the network hardware, we are guaranteed that messages will never be corrupted, but they might get lost.

The post office uses a "postal worker" thread to wait for messages to arrive from the network and to place them in the appropriate queues. This cannot be done in the receive interrupt handler because each queue (implemented with a SynchList) is protected by a lock.


Constructor Summary
PostOffice()
          Allocate a new post office, using an array of SynchLists.
 
Method Summary
 MailMessage receive(int port)
          Retrieve a message on the specified port, waiting if necessary.
 void send(MailMessage mail)
          Send a message to a mailbox on a remote machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostOffice

public PostOffice()
Allocate a new post office, using an array of SynchLists. Register the interrupt handlers with the network hardware and start the "postal worker" thread.

Method Detail

receive

public MailMessage receive(int port)
Retrieve a message on the specified port, waiting if necessary.

Parameters:
port - the port on which to wait for a message.
Returns:
the message received.

send

public void send(MailMessage mail)
Send a message to a mailbox on a remote machine.