?? clientupdatethread.java
字號:
package test;
import java.io.*;
import java.net.*;
import test.*;
public class ClientUpdateThread implements Runnable
{
private Socket socket;
private InputStream is;
private Canvas canvas;
public ClientUpdateThread(Socket socket, Canvas canvas)
{
this.canvas = canvas;
try
{
this.socket = socket;
this.is = this.socket.getInputStream();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void run()
{
byte[] b = new byte[20];
String content[] = new String[4];
while(true)
{
try
{
is.read(b, 0, 20);
content = new String(b).trim().split(",");
canvas.draw
(
new Integer(content[0]).intValue(),
new Integer(content[1]).intValue(),
new Integer(content[2]).intValue(),
new Integer(content[3]).intValue()
);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -