一个Socket的网络编程问题
一个关于Socket的服务器端程序,编译通过,执行抛出异常,请各位看看是什么毛病:
import java.net.*;
import java.io.*;
class Servicer implements Runnable{
Socket s;
public Servicer(Socket s)
{
this.s = s;
}
public void run()
{
try{
InputStream ips = s.getInputStream();
OutputStream ops = s.getOutputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(ips));
DataOutputStream dos = new DataOutputStream(ops);
while(true)
{
String strWord = br.readLine();
//System.out.println(strWord + ": " + strWord.length());
if(strWord.equalsIgnoreCase( "quit "))
break;
String strEcho = (new StringBuffer(strWord).reverse()).toString();