Socket Åë½Å½Ã Client ¿¡¼­ ÀÓÀÇ·Î ¿¬°áÀ» ²÷¾úÀ» ¶§ ¾Ë¼ö ÀÖÀ»Áö...


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :±è±¤È£ 1998³â 7¿ù 10ÀÏ 11:55:56

Áö±Ý MUD¸¦ ¸¸µé°í ÀÖ½À´Ï´Ù.
À̶§ Ŭ¶óÀ̾ðÆ®¿¡¼­ Á¢¼ÓÀ» ÀÓÀÇ·Î ²÷°ÔµÇ¸é(ÇÁ·Î±×·¥ÀÇ °­Á¦ Á¾·á³ª Àü¿ø³»¸² µî) ¼­¹ö¿¡ IOExceptionÀÌ ¸ÕÀú catchµÇ¾î¾ß ÇÏÁö ¾Ê³ª¿ä..? ÇÏÁö¸¸ ½ÇÁö ½ÇÇà½Ã¿¡´Â StringTokenizer¿¡¼­ NullPointerExceptionÀÌ ¹ß»ýµË´Ï´Ù. ÀÌ°ÍÀÌ ´ç¿¬ÇÑ °ÍÀÎÁö¿ä, ¾Æ´Ï¸é ¹«¾ùÀΰ¡°¡ À߸øµÈ°ÍÀÌÁö¿ä, ¶Ç Client¿¡¼­ ÀÓÀÇ·Î Á¢¼ÓÀ» ²÷¾úÀ» ¶§ ¾Ë¼ö ÀÖ´Â ¹æ¹ýÀÌ ¶Ç´Ù¸¥ ÀÖ´ÂÁö¿ä, ÀÖ´Ù¸é ¾Ë·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.


¿©±â Á¦ ¼Ò½º¸¦ ¿Ã¸²´Ï´Ù. º¸½Ã°í ¾îµð°¡ À߸ø µÇ¾ú´ÂÁö ¾Ë·Á ÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.
public void run()
{ try
{
fromClient = new DataInputStream( clientSock.getInputStream() );
toClient = new DataOutputStream( clientSock.getOutputStream() );
System.out.println("Client connected");
while( true )
{
String msg;
String[] msgQ = new String[20];
msg="";
int i=0;
msg=fromClient.readLine();
try {
StringTokenizer st = new StringTokenizer(msg, "_");
while (st.hasMoreTokens()) {
msgQ[i]=st.nextToken();
System.out.println(msgQ[i]);
i++;
}
Server1.broadcast(msgQ);
} catch ( NullPointerException ex )
{ throw ex; }
}
} catch ( NullPointerException ex1 ) {
Server1.removeUrgent(this); }
catch( IOException ex )
{ Server1.removeUrgent( this );
}
}



´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]