网络传输的问题?
这里有一个服务器和一个客户端,运行环境是JB2006,主要就是客户端发送数据,服务器处理,然后在回传一个信息,问题是用Data流很正常,一换成Object流就会卡住(我想用Object流),这是为什么,怎么解决。小弟初学JAVA,谢谢高手指导了。。
//服务器
package com.wvnet;
import java.io.*;
import java.net.*;
public class Server
{
public static void main(String[] args)
{
try
{
ServerSocket serverSocket = new ServerSocket(10001);
int clientNo = 1;
while (true)
{
Socket connectToClient = serverSocket.accept();
System.out.println( "Start thread for client " + clientNo);
HandleAClient thread = new HandleAClient(connectToClient,
clientNo);
thread.start();
clientNo++;
}
} catch (
IOException ex)
{
System.err.println(ex);
}
}
}
class HandleAClient extends Thread
{
private Socket connectToClient;
private int clientNo;
public HandleAClient(Socket socket, int clientNo)
{
connectToClient = socket;
this.clientNo = clientNo;
}
public void run()
{
try
{
// DataInputStream isFromClient = new DataInputStream(
// connectToClient.getInputStream());