1
2
3
4
5 package spellcast.game;
6
7 import spellcast.event.*;
8 import spellcast.model.*;
9
10 /***
11 * This interface allows the game to use inter process communication
12 * to the clients connected to the game. Through the use of this interface
13 * the implemenation specific details are hidden (whether they be tcp/ip or
14 * some other mechanism is irrelevant).
15 *
16 * @author Barrie Treloar
17 */
18 public interface IPC
19 {
20
21 /***
22 * Send an event to the specified client.
23 * Does not block.
24 */
25 public void send( Id recipient, GameEvent e );
26
27 /***
28 * Send the event to all clients.
29 * Equivalent to calling <code>send</code> multiple times for all clients.
30 */
31 public void sendToAll( GameEvent e );
32
33 /***
34 * Receive an event from a client.
35 * This will block until an event is received.
36 */
37 public IPCRequest receive();
38
39 /***
40 * Connect the handle with the specified Id.
41 */
42 public void connect( IPCHandle handle, Id client );
43
44 /***
45 * Disconnect the client.
46 */
47 public void disconnect( IPCHandle handle );
48 }
49