知识大全 Java语言的Socket类[2]

Posted 语言

篇首语:好好学习,天天向上。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 Java语言的Socket类[2]相关的知识,希望对你有一定的参考价值。

Java语言的Socket类[2]  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!

   isr = new InputStreamReader (s getInputStream ());

   // Create a buffered reader that chains to the input stream

   // reader The buffered reader supplies a convenient method

   // for reading entire lines of text

   br = new BufferedReader (isr);

   // Create a print writer that chains to the socket´s byte

   // oriented output stream The print writer creates an

   // intermediate output stream writer that converts

   // characters sent to the socket to bytes The conversion

   // is based on the platform´s default character set

   pw = new PrintWriter (s getOutputStream () true);

   // Send the DATE mand to the server

   pw println ( DATE );

   // Obtain and print the current date/time

   System out println (br readLine ());

   // Send the PAUSE mand to the server This allows several

   // clients to start and verifies that the server is spawning

   // multiple threads

   pw println ( PAUSE );

   // Send the DOW mand to the server

   pw println ( DOW );

   // Obtain and print the current day of week

   System out println (br readLine ());

   // Send the DOM mand to the server

 

   pw println ( DOM );

   // Obtain and print the current day of month

   System out println (br readLine ());

   // Send the DOY mand to the server

   pw println ( DOY );

cha138/Article/program/Java/hx/201311/27217

相关参考