Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
15 arune 1
/*
2
 * MbInternetAddress.java
3
 *
4
 * Created on den 26 augusti 2003, 11:37
5
 */
6
package Macbeth.System;
7
 
8
/**
9
 * Holds an address to a kernel server.
10
 * This simply consists of a hostname and a port.
11
 * @author Jimmy
12
 */
13
public class MbInternetAddress {
14
    private String hostname;
15
    private int port;
16
 
17
    /** Creates a new instance of MbInternetAddress */
18
    public MbInternetAddress() {
19
        this.hostname = "localhost";
20
        this.port = 19000;
21
    }
22
 
23
    /** Creates a new instance of MbInternetAddress */
24
    public MbInternetAddress(String hostname, int port) {
25
        this.hostname = hostname;
26
        this.port = port;
27
    }
28
 
29
    /**
30
     * Gets the hostname. Can be an ip number or a dns name.
31
     * @return The hostname. There is no guarantee that this is a valid hostname.
32
     */
33
    public String getHostname() {
34
        return hostname;
35
    }
36
 
37
    /**
38
     * Sets the hostname. Can be an ip number or a dns name.
39
     * The hostname will not be checked for validity.
40
     * @param hostname The hostname.
41
     */
42
    public void setHostname(String hostname) {
43
        this.hostname = hostname;
44
    }
45
 
46
    /**
47
     * Gets the port.
48
     * @return The port number;
49
     */
50
    public int getPort() {
51
        return port;
52
    }
53
 
54
    /**
55
     * Sets the port.
56
     * @param port The port number.
57
     */
58
    public void setPort(int port) {
59
        this.port = port;
60
    }
61
 
62
    /**
63
     * Thrown when this address is invalid (i.e. can't be reached)
64
     */
65
    public static class InvalidAddressException extends Exception {
66
        public InvalidAddressException(String s) {
67
            super(s);
68
        }
69
        public InvalidAddressException() {
70
            super();
71
        }
72
    }
73
}