领测软件测试网
软件测试技术门户Rq~
M3rFVg软件测试技术门户`'L3M4w L+Iur5W\+Q // End of Connection class
dq;k5Y L+j#y9w 3、编写客户机类Java 程序
软件测试技术门户Y
y4m~i // Client.java
M(fhH:v`
Y"K d0p import java.io.*;
软件测试技术门户7K's @*t]-@1xD2TX import java.net.*;
_9N-BlB5I^"|/e,@ Q[ public class Client extends
软件测试技术门户`wX Kj'UR!i {
(nm6}R*jz'tF public static final int Default_Port = 6543;
F/f;m0Q$w|&W6Kc%}[V // 定义出错例程
软件测试技术门户 {(kd9O*|&h'X2e public static final void usage()
ZV@/j%FqT {
软件测试技术门户C[1M:\VB2z E System.out.println("Usage: Java Client []");
软件测试技术门户j}/hiMFk System.exit(0);
RS/SU(E4t@0eA }
jv3i(|^5_ public static void main(String args[])
t-fV@,W'XsB
x A1U:k {
O?^U#J{#mq0l int port = Default_Port;
`
h
f C*X0H!r.\'Z:I |v Socket s = null;
}}'r(`3Va-K // 解析端口参数
3[rk(ax&e&YM if ((args.length != 1)&&(args.length != 2 )) usage();
Vr:L}|xjO!y if (args.length == 1)
+? t-Kq+~