(2000 12 Jr.) from Yongwoo s Park Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 1
Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 2
1. /... 4 1.1 /...4 1.2 /...6 1.3...7 ClientLobby/Lobby... 8 ClientRoom/Room... 9 2....10 2.1 (DIALOGBOX)...10...13 (CardLayout)...14 Absolute Positioning...15 3. /...17 3.1 SOCKET SERVERSOCKET...17 3.2 /...18 - PpiKki...18 - ServerPlayer...20 Lobby...21 Room...24 ClientLobby...27 Client...30 4. 3.....33 Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 3
from Yongwoo s Park (KawuiBawuiBo)..,.,..., /,.,,.,. ^^...,.,.. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 4
1. /. 1 /.,. (.) ClientLobby PpiKki ServerSocket accept 4001 (Socket),. PpiKki ServerSocket 4001 (accept),,, ServerPlayer., ServerPlayer ClientLobby. PpiKki ServerPlayer, Lobby chatlist., Lobby Room. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 5
Lobby Room, ServerPlayer chatlist.,, ServerPlayer chatlist. Lobby chatlist ServerPlayer Room playerlist., ClientRoom. /.,,. ClientLobby,.,,,., ClientRoom. ClientRoom.,.,, ClientLobby.,,. PpiKki,. ( ) (ServerSocket 4001 accept.),, ServerPlayer ServerPlayer., ServerPlayer Lobby chatlist, Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 6
Lobby.,,,. ServerPlayer.,., ServerPlayer Lobby chatlist Room playerlist,. Lobby (Room)., PpiKki ServerPlayer, Lobby chatlist, Lobby chatlist., Room, ServerPlayer chatlist Room playerlist,.,, Lobby ServerPlayer chatlist Room playerlist. Room. Room., Room Lobby ServerPlayer playerlist.,,..,.,. (ClientLobby) (Lobby) Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 7
(Lobby) (ClientLobby) (ClientRoom) (Room) (Room) (ClientRoom), (ClientLobby), (Lobby)., ClientLobby Lobby, ClientLobby Lobby,. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 8
2. ClientLobby Lobby, ClientRoom Room. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 9
3. ClientRoom Room (Dialogbox) Dialog., Dialog., (modal) (non-modal modal-less).., Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 10
,,. (modal-less or non-modal),.. TextDialog WarningDialog,. 1. TextDialog.java, WarningDialog.java class TextDialog extends Dialog { Label msglabel = null; TextField field = null; String strtitle=null; public TextDialog(Frame owner, String title, String msg) { super(owner, title); // setmodal(true); // /* */ addwindowlistener(new WindowAdapter() { public void windowclosing(windowevent e) { field.settext(""); dispose(); // ); field.addactionlistener(new ActionListener() { public void actionperformed(actionevent ae) { if(ae.getsource() == field) { dispose(); ); class WarningDialog extends Dialog { Button okbutton=null; Label msglabel=null; public WarningDialog(Frame owner, String title, String message) { super(owner, title, true); //, modal /* */ okbutton.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { dispose(); ); addwindowlistener(new WindowAdapter() { public void windowclosing(windowevent e) { dispose(); ); pack(); autoalign(); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 11
public void autoalign() { // int sw = Toolkit.getDefaultToolkit().getScreenSize().width; int sh = Toolkit.getDefaultToolkit().getScreenSize().height; int dw = getsize().width; int dh = getsize().height; int x = (((sw - dw) / 2) < 0)? 0 : ((sw - dw) / 2); int y = (((sh - dh) / 2) < 0)? 0 : ((sh - dh) / 2); setlocation(x, y);,. 2. ClientLobby.java TextDialog s = new TextDialog((Frame)(ClientLobby.this.getParent()), "...", "..."); s.show(); roomid = s.field.gettext().trim(); if(!"".equals(roomid)) { /* */ WarningDialog w = new WarningDialog((Frame)(ClientLobby.this.getParent()), "Warning", "."); w.show();,. 4. TextDialog WarningDialog Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 12
..,. : setlocation(x, y) setsize(width, height). :, paint. 3. ImageComponent.java, ImageButton.java class ImageComponent extends Canvas { Image image=null; public ImageComponent(Image image) { this.image = image; if(this.image!= null) { setsize(image.getwidth(this), image.getheight(this)); public void paint(graphics g) { if(image!= null) { g.drawimage(image, 0, 0, this); class ImageButton extends Canvas { private Image currentimage=null; private Image pressedimage=null; private Image releasedoffimage=null; private Image releasedonimage=null; private ActionListener al=null; public ImageButton(Image releasedoff, Image releasedon, Image pressed) { this.pressedimage = pressed; this.releasedoffimage = releasedoff; this.releasedonimage = releasedon; this.currentimage = releasedoff; setsize(releasedoff.getwidth(this), releasedoff.getheight(this)); addmouselistener(new MouseAdapter () { public void mousepressed(mouseevent e) { Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 13
currentimage = pressedimage; repaint(); public void mousereleased(mouseevent e) { currentimage = releasedoffimage; repaint(); ActionEvent ae = new ActionEvent(ImageButton.this, ActionEvent.ACTION_PERFORMED, "ImageButton"); al.actionperformed(ae); // ActionListener public void mouseentered(mouseevent e) { currentimage = releasedonimage; repaint(); public void mouseexited(mouseevent e) { currentimage = releasedoffimage; repaint(); ); public void addactionlistener(actionlistener al) { this.al = al; // ActionEvent ActionListener public void paint(graphics g) { if(currentimage!= null) { g.drawimage(currentimage, 0, 0, getsize().width, getsize().height, this); ImageCanvas ImageButton., paint., ImageButton, AWT Button ActionListener, ActionEvent., addactionlistener() ActionListener, ActionEvent, ActionListener.,,,., ka wuibawuibo CardLayout Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 14
LobbyPanel lobbypanel, BoardPanel boardpanel cardpanel (makebutton) (joinbutton).,, lobbypanel boardpanel. kawuibawuibocardlayout.show(cardpanel, "BoardPanel");, Client (exitbutton), boardpanel lobbypanel Client parentapplet. parentapplet. kawuibawuibocardlayout.show(parentapplet.cardpanel, "LobbyPanel");,. 5. Panel.,,. ClientLobby. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 15
, ImageCanvas.,,. null,., ImageCanvas lobbypanel (add),. ImageCanvas lobbypanel,. 4 (x, y, width, height).,,. public class ClientLobby extends Applet implements Runnable { /* */ public Panel initlobbypanel() { /* */ lobbypanel = new Panel(null); backgroundcanvas.setbounds(0, 0, 776, 585); roomlist.setbounds(14, 145, 537, 212); playerlist.setbounds(568, 145, 202, 212); chatarea.setbounds(80, 389, 690, 101); chatfield.setbounds(14, 502, 756, 26); lobbypanel.add(roomlist); lobbypanel.add(playerlist); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 16
lobbypanel.add(chatarea); lobbypanel.add(chatfield); lobbypanel.add(makeroombutton); lobbypanel.add(joinroombutton); lobbypanel.add(exitbutton); lobbypanel.add(backgroundcanvas); // add (mechanism).,. ServerSocket (server socket)., ServerSocket Socket /,. 6. / Client Client Program Program String host = park.konkuk.ac.kr ; Socket s = new Socket(host, 4444); Connection established Server Server Program Program ServerSocket server; server = new ServerSocket (4444); Socket s = server.accept(); #1234 #1234 TCP/IP TCP/IP #4444 #4444 Inputstream in = s.getinputstream(); Outputstream out = s.getoutputstream(); Inputstream in = s.getinputstream(); Outputstreamout = s.getoutputstream(); /* Communication */ in out out in /* Communication */ In.close(); out.close(); s = null; In.close(); out.close(); s = null; park.konkuk.ac.kr (listen),. 6., 4444 (listen), 4444.,, ( 1234) Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 17
. ( )., PpiKki, ServerPlayer, Lobby, Room, ClientLobby, Client., TCP/IP PpiKki, ServerPlayer, ClientLobby., PpiKki ServerSocket 4001., 4001, ServerPlayer, ServerPlayer., ClientLobby 4001 Socket, Socket ( ServerPlayer). ServerSocket PpiKki, main. main 4001 PpiKki, PpiKki., PpiKki 4001 ServerSocket, Lobby Lobby., PpiKki run (accept), ServerPlayer, ServerPlayer. ServerPlayer Lobby addplayer, Lobby., SO_TIMEOUT,,. player.socket.setsotimeout(10); //, 10msec SO_TIMEOUT Lobby., Lobby Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 18
,, (Blocking).., TIMEOUT, SO_TIMEOUT., Lobby GRoom. public class PpiKki extends Thread { final static int KAWUI_BAWUI_BO_GAME_PORT=4001; Lobby lobby=null; ServerSocket ppikkisocket=null; public static void main(string args[]) { System.out.println("MW Game Server Running..."); PpiKki ppikki = new PpiKki(); ppikki.start(); public PpiKki() { try { ppikkisocket = new ServerSocket(KAWUI_BAWUI_BO_GAME_PORT); catch(ioexception e) { System.out.println("IOException: "+e); System.exit(1); lobby = new Lobby(); lobby.start(); public void run() { Socket socket=null; ServerPlayer player=null; System.out.println("PpiKki thread is started..."); while(true) { try { socket = ppikkisocket.accept(); if(socket == null) { System.out.println("Can't create a socket..."); continue; else { player = new ServerPlayer(socket, lobby, null); if(player == null) { System.out.println("Can't create a player..."); continue; lobby.addplayer(player); catch(exception e) { e.printstacktrace(); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 19
ServerPlayer. ServerPlayer (ClientLobby), PpiKki ServerPlayer PpiKki. BufferedReader, PrintWriter. receivemessage sendmessage., receivemessage, SocketException IOException throw.,., ServerPlayer receivemessage Lobby Room, removeplayer. class ServerPlayer { public Socket socket=null; public BufferedReader is=null; public PrintWriter os=null; /* */ ServerPlayer(Socket socket, Lobby lobby, Room room) throws IOException { is = new BufferedReader(new InputStreamReader(socket.getInputStream())); os = new PrintWriter(socket.getOutputStream(), true); if(is == null) { throw new IOException(); if(os == null) { throw new IOException(); this.socket = socket; this.lobby = lobby; this.room = room; getinitialinfo(); socket.setsotimeout(10); public void getinitialinfo() { if(is!= null) { try { sendmessage("username"); playerid = receivemessage(); catch(socketexception e) { clear(); // // Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 20
catch(ioexception e) { clear(); public void sendmessage(string message) { if(message!= null) { os.println(message); os.flush(); if(os.checkerror()) { lobby.removeplayer(this); // ( ). // // System.out.println("Send: "+message); public String receivemessage() throws SocketException, IOException { String message=null; try { message = is.readline(); if(message == null) { // // throw(new IOException("Null pointer received...")); System.out.println("Recv: "+message); catch(socketexception e) { throw(e); catch(interruptedioexception e) { message = ""; catch(ioexception e) { throw(e); catch(exception e) { /* */ message = ""; return(message); Lobby. Lobby PpiKki. PpiKki 4001, ServerPlayer, Lobby chatlist., Lobby Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 21
chatlist ServerPlayer receivemessage,. public class Lobby extends Thread { Hashtable chatlist=null; Hashtable roomlist=null; // // public Lobby() { chatlist = new Hashtable(); roomlist = new Hashtable(); //, public void addplayer(serverplayer player) { if(player.playerid!= null && chatlist.get(player.playerid) == null){ String message=null; chatlist.put(player.playerid, player); message = "300 UNICAST "+player.playerid+" " +player.playerid+" ["+player.playerid+"]..."; player.sendmessage(message); message = "300 BROADCAST "+player.playerid +" * ["+player.playerid+"].."; broadcastmessage(message); sendroomlist(player.playerid); broadcastuserlist(" "); // public void takeplayerfromroom(serverplayer player) { chatlist.put(player.playerid, player); // public void removeplayer(serverplayer player) { chatlist.remove(player.playerid); broadcastuserlist(" "); // ServerPlayer public void sendmessage(string playerid, String message) { ServerPlayer player = (ServerPlayer)chatList.get(playerId); if(player!= null) { player.sendmessage(message); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 22
// public void makeroom(string playerid, String roomid) { ServerPlayer player = (ServerPlayer)chatList.get(playerId); Room room = new Room(roomId, player); roomlist.put(roomid, room); room.start(); // public void removeroom(string roomid) { Room room = (Room)roomList.get(roomId); if(room!= null) { roomlist.remove(roomid); room = null; broadcastroomlist(); public void broadcastmessage(string message) { /* */ public void broadcastroomlist() { /* */ public void sendroomlist(string playerid) { /* */ public void senduserlist(string playerid, String roomid) { /* */ public void broadcastuserlist(string roomid) { /* */ public boolean enterroom(string playerid, String roomid) { /* */ //.. public void run() { while(true) { // Read Data try { sleep(100); catch(interruptedexception ie) { // Enumeration e = chatlist.elements(); while(e.hasmoreelements()) { ServerPlayer player = (ServerPlayer)e.nextElement(); try { String receive = null; receive = player.receivemessage(); if(receive == null "".equals(receive)) { continue; StringTokenizer st = new StringTokenizer(receive, " "); String command = st.nexttoken(); //, if("100".equals(command)) { // 100 BROADCAST playerid * chatstr String type = st.nexttoken(); String playerid = st.nexttoken(); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 23
/* */ String target = st.nexttoken(); String chatstr = st.nexttoken(); String message = "300 BROADCAST " broadcastmessage(message); else if("102".equals(command)) { else if("104".equals(command)) { else if("110".equals(command)) { String playerid = st.nexttoken(); sendroomlist(playerid); else if("112".equals(command)) { +playerid+" * ["+player.playerid+"] "+chatstr; // 112 playerid roomid String playerid = st.nexttoken(); String roomid = st.nexttoken(); senduserlist(playerid, roomid); els e if("120".equals(command)) { // 120 playerid roomid String playerid = st.nexttoken(); String roomid = st.nexttoken(); makeroom(playerid, roomid); broadcastroomlist(); else if("122".equals(command)) { // 122 playerid roomid else if("180".equals(command)) { // 180 JOIN playerid else if("182".equals(command)) { // 182 LEAVE playerid catch(socketexception ne) { removeplayer(player); catch(ioexception ne) { removeplayer(player); Room. Room., Lobby, Room., chatlist ServerPlayer Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 24
, Room playerlist., Lobby Room,. Room Lobby.,. Room ServerPlayer receivemessage,. class Room extends Thread { String roomid=null; ServerPlayer hostplayer=null; Vector playerlist=null; /* */ public Room(String roomid, ServerPlayer player) { this.roomid = roomid; this.hostplayer = player; playerlist = new Vector(); addplayer(player); synchronized public void addplayer(serverplayer player) { if(!playerlist.contains(player)) { playerlist.addelement(player); player.room = this; broadcastuserlist(); if(playerlist.size() == 2) { startgame(); synchronized public void removeplayer(serverplayer player) { if(player == null) { return; player.room = null; if(playerlist.contains(player)) { playerlist.removeelement(player); player.lobby.takeplayerfromroom(player); if(playerlist.size() == 0) { player.lobby.removeroom(roomid); broadcastuserlist(); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 25
public void run() { String receive=null, message=null; Enumeration enum=null; ServerPlayer player=null; while(true) { // Read Data try { Thread.sleep(50); catch(interruptedexception ie) { enum = playerlist.elements(); while(enum.hasmoreelements()) { player = (ServerPlayer)enum.nextElement(); try { receive = player.receivemessage(); if(receive == null "".equals(receive)) { continue; // MW Game Protocol // nnn arg1 arg2 arg3... StringTokenizer st = new StringTokenizer(receive, " "); String command = st.nexttoken(); if("500".equals(command)) { // 500 BROADCAST playerid * chatstr else if("502".equals(command)) { else if("504".equals(command)) { else if("512".equals(command)) { // 512 playerid roomid else if("520".equals(command)) { // 520 START playerid else if("522".equals(command)) { // 522 PUT playerid [KAWUI BAWUI BO] else if("524".equals(command)) { // 524 POINT playerid point1 else if("580".equals(command)) { // 580 JOIN_ROOM playerid else if("582".equals(command)) { // 582 EXIT_ROOM playerid catch(socketexception e) { //Stream doesn't exist. removeplayer(player); catch(ioexception e) { //Stream doesn't exist. removeplayer(player); catch(exception e) { Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 26
ClientLobby Runnable Applet. ClientLobby.,., ClientLobby Client processmessage,.., ClientLobby init, BufferedReader PrintWriter I/O., Client sendtoserver receivemessage. ClientLobby, start stop., run, ClientLobby Client processmessage., ClientLobby processmessage. public class ClientLobby extends Applet implements Runnable { static String KAWUI_BAWUI_BO_GAME_SERVER; final static int KAWUI_BAWUI_BO_GAME_PORT=4001; public Socket socket=null; public BufferedReader is=null; public PrintWriter os=null; public void init() { KAWUI_BAWUI_BO_GAME_SERVER = getcodebase().gethost(); kawuibawuibocardlayout = new CardLayout(); cardpanel = new Panel(kawuiBawuiBoCardLayout); lobbypanel = initlobbypanel(); boardpanel = new ClientRoom(ClientLobby.this); connect(); cardpanel.add(lobbypanel, "LobbyPanel"); cardpanel.add(boardpanel, "BoardPanel"); setlayout(new BorderLayout()); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 27
add("center", cardpanel); kawuibawuibocardlayout.show(cardpanel, "LobbyPanel"); public Panel initlobbypanel() { /* */ return(lobbypanel); private void connect() { playerid = ""+new Date().getTime(); // try { socket = new Socket(KAWUI_BAWUI_BO_GAME_SERVER, KAWUI_BAWUI_BO_GAME_PORT); is = new BufferedReader(new InputStreamReader(socket.getInputStream())); os = new PrintWriter(socket.getOutputStream(), true); String receive=null; StringTokenizer st = null; String command = null; try { receive = receivemessage(); // "UserName" is read sendtoserver(playerid); socket.setsotimeout(10); // 10ms catch(exception e) { //Unknown error. Throw tantrum. chatarea.append(" : "+e+"\n"); catch(unknownhostexception e) { chatarea.append(" : "+e+"\n"); stop(); return; catch(socketexception e) { chatarea.append(" : "+e+"\n"); stop(); return; catch(ioexception e) { chatarea.append(" : "+e+"\n"); stop(); return; public synchronized void start() { /* */ public synchronized void stop() { /* */ Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 28
public void sendtoserver(string message) { if(message!= null) { os.println(message); os.flush(); if(os.checkerror()) { public String receivemessage() throws SocketException { String message = null; try { message = is.readline(); catch(socketexception e) { throw(e); catch(exception e) { return ""; return message; public void run() { String receive=null; while(thread.currentthread() == clientlobbythread) { try { Thread.sleep(100); catch(interruptedexception e) { try { receive = receivemessage(); if((receive == null) ("".equals(receive))) { continue; processmessage(receive); boardpanel.processmessage(receive); catch(socketexception e) { //Stream doesn't exist. stop(); return; catch(exception e) { //Unknown error. Throw tantrum. public void processmessage(string receive) { StringTokenizer st = new StringTokenizer(receive, " "); String command = st.nexttoken(); if("300".equals(command)) { // // 300 BROADCAST playerid * chatstr Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 29
String type = st.nexttoken(); String playerid = st.nexttoken(); String target = st.nexttoken(); String chatstr = st.nexttoken(); chatarea.append(chatstr+"\n"); else if("302".equals(command)) { // /* */ Client,. Client Panel.., Client ClientLobby..,., Client processmessage ClientLobby run. public class ClientRoom extends Panel { ClientLobby parentapplet=null; /* */ public ClientRoom(ClientLobby parentapplet) { this.parentapplet = parentapplet; init(); public void init() { /* */ ActionListener al = new ActionListener() { public void actionperformed(actionevent e) { String message=null; if(e.getsource() == chatfield) { String chatstr = chatfield.gettext(); if(!"".equals(chatstr)) { message = "500 BROADCAST " +parentapplet.playerid+" * "+chatstr; sendtoserver(message); Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 30
; chatfield.settext(""); else if(e.getsource() == kawuibutton) { message = "522 PUT "+parentapplet.playerid+" KAWUI"; sendtoserver(message); messageboard("."); setbuttonevent(false); else if(e.getsource() == bawuibutton) { message = "522 PUT "+parentapplet.playerid+" BAWUI"; sendtoserver(message); messageboard("."); setbuttonevent(false); else if(e.getsource() == bobutton) { message = "522 PUT "+parentapplet.playerid+" BO"; sendtoserver(message); messageboard("."); setbuttonevent(false); else if(e.getsource() == exitbutton) { sendtoserver("582 EXIT_ROOM "+parentapplet.playerid); parentapplet.kawuibawuibocardlayout.show(parentapplet.cardpanel, parentapplet.buttondefaultsetting(); "LobbyPanel"); chatfield.addactionlistener(al); kawuibutton.addactionlistener(al); bawuibutton.addactionlistener(al); bobutton.addactionlistener(al); exitbutton.addactionlistener(al); /* */ // offimage = parentapplet.createimage(parentapplet.getsize().width, offgraphics = offimage.getgraphics(); // public void update(graphics g) { paint(g); public void paint(graphics g) { parentapplet.getsize().height); offgraphics.drawimage(backgroundimage, 0, 0, this); offgraphics.drawimage(kawuiimage, 110, 190, 100, 100, this); offgraphics.drawimage(bawuiimage, 355, 190, 100, 100, this); switch(myx) { case 0: offgraphics.drawimage(kawuiimage, 110, 190, 100, 100, this); break; case 1: offgraphics.drawimage(bawuiimage, 110, 190, 100, 100, this); break; case 2: offgraphics.drawimage(boimage, 110, 190, 100, 100, this); break; Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 31
default: offgraphics.setcolor(color.lightgray); offgraphics.fillrect(110, 190, 100, 100); break; switch(yourx) { case 0: offgraphics.drawimage(kawuiimage, 355, 190, 100, 100, this); break; case 1: offgraphics.drawimage(bawuiimage, 355, 190, 100, 100, this); break; case 2: offgraphics.drawimage(boimage, 355, 190, 100, 100, this); break; default: offgraphics.setcolor(color.lightgray); offgraphics.fillrect(355, 190, 100, 100); break; g.drawimage(offimage, 0, 0, this); public void messageboard(string message) { chatarea.append("\n[ ] "+message+"\n\n"); public String receivemessage() throws SocketException { try { return(parentapplet.receivemessage()); catch(socketexception e) { throw(e); public void sendtoserver(string message) { /* */ parentapplet.sendtoserver(message); public void processmessage(string receive) { StringTokenizer st = new StringTokenizer(receive, " "); String command = st.nexttoken(); if("700".equals(command)) { // // 700 BROADCAST playerid * chatstr String type = st.nexttoken(); String playerid = st.nexttoken(); String target = st.nexttoken(); String chatstr = st.next Token(); chatarea.append(chatstr+"\n"); else if("702".equals(command)) { // /* */ /* */ Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 32
, 3.,.,,.,. 3. Java Network KawuiBawuiBo Game Programming from Yongwoo s Park 33