我写了一个程序功能是实现:
客户方发送两个整数给服务器,服务器把计算结果返回给客户
但是我运行的时候发送了两个数以后,服务器就是不发送结果过来,请高手帮忙看一下
很急的,满分送,谢谢//tcpclient.java客户端程序
import java.io.*;
import java.net.*;
public class tcpclient 
{
    public static void main(String[] args) throws  IOException
    {
        Socket soc=null;
        DataInputStream in=null;
        PrintStream out=null;
        DataInputStream sysin=null;
        String strin=null;
        String strout=null;
        try
        {
            soc=new Socket(args[0],8000);
            System.out.println("Connecting to the Server");
            in=new DataInputStream(soc.getInputStream());
            out=new PrintStream(soc.getOutputStream());
            strin=in.readLine();
            System.out.println("Server said:"+strin);
            sysin=new DataInputStream(System.in);
            strout=sysin.readLine();
            while (!strout.equals("quit"))
            {
                out.println(strout);
                strout=sysin.readLine();
            }
            out.println(strout);
        }
        catch(Exception e)
        {
            System.out.println("error:"+e);
        }
        finally
        {
            in.close();
            out.close();
            soc.close();
            sysin.close();
            System.exit(0);
        }
    }
}//tcpserver.java主机程序
import java.io.*;
import java.net.*;
public class tcpserver
{
    public static void main(String[] args) throws  IOException
    {
        ServerSocket svrsoc=null;
        Socket soc=null;
        DataInputStream in=null;
        PrintStream out=null;
        InetAddress clientIP=null;
        String str=null;
        int a=0;
        int b=0;
        try
        {
            svrsoc=new ServerSocket(8000);
            System.out.println("Server start....");
            soc=svrsoc.accept();
            in=new DataInputStream(soc.getInputStream());
            out=new PrintStream(soc.getOutputStream());
            clientIP=soc.getInetAddress();
            System.out.println("Client's IP address:"+clientIP);
            out.println("welcome.....");
            str=in.readLine();
            int i=0;
            while (!str.equals("quit"))
            {
if(i==0){
          a=Integer.parseInt(str);
          i=1;
         }
else{
  b=Integer.parseInt(str);
          int c=a+b;
          String d=Integer.toString(c);
          out.println(d);
          out.flush();
          i=0;
 }
                str=in.readLine();            }
            System.out.println("Client want to leave");
        }
        catch(Exception e)
        {
            System.out.println("error:"+e);
        }
        finally
        {
            in.close();
            out.close();
            soc.close();
            svrsoc.close();
            System.exit(0);
        }
    }
}