?? testnwclient.java
字號:
package trader.nw;
import java.io.*;
import java.net.*;
public class TestNwClient {
public static void main(String args[]) {
int port = 6001;
int count = 0;
Object obj = null;
NwClient nwc;
if (args.length > 0){
try {
port = Integer.parseInt(args[0]);
} catch(Exception e) {
System.out.println("TestNwClient " + e);
}
}
nwc = new NwClient("localhost", port);
try {
while (true) {
// send object
obj = "message" + count++;
try {
nwc.send(obj);
} catch(Exception e) {
System.out.println("TestNwClient " + e);
}
// receive object
obj = null;
try {
obj = nwc.receive();
System.out.println("TestNwClient received " + obj);
} catch(Exception e) {
System.out.println("TestNwClient receive " + e);
}
Thread.sleep(4000);
}
} catch(Exception e) {
System.out.println("TestNwClient: " + e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -