KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > utobcast > TCPProcess


1 /**
2  * Dream
3  * Copyright (C) 2003 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: vivien.quema@inrialpes.fr
20  *
21  * Initial developer(s): Vivien Quema
22  * Contributor(s):
23  */

24
25 package utobcast;
26
27 import java.net.InetAddress JavaDoc;
28
29 import org.objectweb.dream.protocol.ProcessImpl;
30
31 /**
32  * This class implements a TCP process. Such a process is remotely accessible
33  * using a TCP channel. It is identified by an IP address and a port number.
34  */

35 public class TCPProcess extends ProcessImpl JavaDoc
36 {
37
38   // IP address
39
private InetAddress JavaDoc inetAddr;
40
41   // port number
42
private int port;
43
44   // ---------------------------------------------------------------------------
45
// Constructor.
46
// ---------------------------------------------------------------------------
47

48   /**
49    * Allocates a new TCPProcess object.
50    *
51    * @param id the identifier of the process.
52    * @param inetAddr the inet address of the process.
53    * @param port of the process.
54    */

55   public TCPProcess(short id, InetAddress JavaDoc inetAddr, int port)
56   {
57     super(id);
58     this.inetAddr = inetAddr;
59     this.port = port;
60
61   }
62
63   // ---------------------------------------------------------------------------
64
// Methods.
65
// ---------------------------------------------------------------------------
66

67   /**
68    * Returns the inet address of the process.
69    *
70    * @return the inet address of the process.
71    */

72   public InetAddress JavaDoc getInetAddress()
73   {
74     return inetAddr;
75   }
76
77   /**
78    * Returns the port of the process.
79    *
80    * @return the port of the process.
81    */

82   public int getPort()
83   {
84     return port;
85   }
86 }
Popular Tags