KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > net > MyClient


1 package org.sapia.ubik.net;
2
3
4 /**
5  * @author Yanick Duchesne
6  * <dl>
7  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
8  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
9  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
10  * </dl>
11  */

12 public class MyClient {
13   /**
14    * Constructor for MyClient.
15    */

16   public MyClient() {
17     super();
18   }
19
20   public static void main(String JavaDoc[] args) {
21     try {
22       SocketConnection conn = new SocketConnection(new java.net.Socket JavaDoc(
23             "localhost", 6666));
24
25       while (true) {
26         System.out.println("Sending...");
27
28         conn.send("This is foo!!!");
29
30         System.out.println("Receiving...");
31
32         System.out.println(conn.receive());
33
34         Thread.sleep(3000);
35       }
36     } catch (Throwable JavaDoc t) {
37       t.printStackTrace();
38     }
39   }
40 }
41
Popular Tags