?? client.java
字號:
import java.net.*;
import java.io.*;
class client{
Socket so;
public client(String host,int port) throws IOException
{
try
{
so = new Socket(host, port);
}
catch (IOException e) { }
}
public void go()
{
System.out.println("before try");
if (so != null)
{
try
{
echange(so.getInputStream(), so.getOutputStream());
}
catch (IOException e)
{
System.err.println("Erreur " + e);
}
}
}
public void stop()
{
try{
if (so != null)
so.close();
}
catch(IOException e){}
}
public void echange(InputStream is,OutputStream os) throws IOException
{
DataInputStream dis=new DataInputStream(is);
String tmp = dis.readUTF();
System.out.println(tmp);
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF(tmp);
}
public static void main(String argc[])
{
try{
client c = new client("localhost",3000);
c.go();
c.stop();
}
catch(IOException e){}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -