KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > sitraka > Socket


1 /*
2  * Copyright 2001-2002,2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.tools.ant.taskdefs.optional.sitraka;
18
19 /**
20  * Define a host and port to connect to if you want to do remote viewing.
21  * <tt>&lt;socket/&gt;</tt> defaults to host 127.0.0.1 and port 4444
22  *
23  * Otherwise it requires the host and port attributes to be set:
24  * <tt>
25  * &lt;socket host=&quote;175.30.12.1&quote; port=&quote;4567&quote;/&gt;
26  * </tt>
27  */

28 public class Socket {
29
30     /** default to localhost */
31     private String JavaDoc host = "127.0.0.1";
32
33     /** default to 4444 */
34     private int port = 4444;
35
36     /**
37      * the host name/ip of the machine on which the Viewer is running;
38      * defaults to localhost.
39      */

40     public void setHost(String JavaDoc value) {
41         host = value;
42     }
43
44     /**
45      * Optional port number for the viewer; default is 4444
46      */

47     public void setPort(Integer JavaDoc value) {
48         port = value.intValue();
49     }
50
51     /** if no host is set, returning ':&lt;port&gt;', will take localhost */
52     public String JavaDoc toString() {
53         return host + ":" + port;
54     }
55 }
56
Popular Tags