Java Socket??????
???????????? ???????[ 2016/3/8 10:38:53 ] ??????????????? ???????????
??????????
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
public class Client {
public static final String IP = "localhost";//?????????
public static final int PORT = 8000;//??????????
public static void main(String[] args) {
handler();
}
private static void handler(){
try {
//????????Socket????????????????????
Socket client = new Socket(IP?? PORT);
//?????????????????????????????д
new Thread(new ReadHandlerThread(client)).start();
new Thread(new WriteHandlerThread(client)).start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/*
*??????????????
*/
class ReadHandlerThread implements Runnable{
private Socket client;
public ReadHandlerThread(Socket client) {
this.client = client;
}
@Override
public void run() {
DataInputStream dis = null;
try {
while(true){
//???????????????
dis = new DataInputStream(client.getInputStream());
String receive = dis.readUTF();
System.out.println("??????????????????: " + receive);
}
} catch (IOException e) {
e.printStackTrace();
} finally{
try {
if(dis != null){
dis.close();
}
if(client != null){
client = null;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/*
* ????д?????????
*/
class WriteHandlerThread implements Runnable{
private Socket client;
public WriteHandlerThread(Socket client) {
this.client = client;
}
@Override
public void run() {
DataOutputStream dos = null;
BufferedReader br = null;
try {
while(true){
//????????
dos = new DataOutputStream(client.getOutputStream());
System.out.print("??????: ");
//???????
br = new BufferedReader(new InputStreamReader(System.in));
String send = br.readLine();
//????????
dos.writeUTF(send);
}
} catch (IOException e) {
e.printStackTrace();
} finally{
try{
if(dos != null){
dos.close();
}
if(br != null){
br.close();
}
if(client != null){
client = null;
}
}catch(Exception e){
e.printStackTrace();
}
}
}
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????