求助: Socket的InputStream和OutputStream的问题

06-04-04 nyquist
小弟遇到一个问题:

class MyRunnable implements java.lang.Runnable{
	public java.net.Socket __sc;
	public java.io.InputStream __is;
	public java.io.OutputStream __os;
	public java.io.ObjectInputStream __ois;
	public java.io.ObjectOutputStream __oos;
	
	public MyRunnable(Socket sc) throws IOException{
		
		__sc = sc;
		__is = __sc.getInputStream();
		__os = __sc.getOutputStream();	
		System.out.println("__is and __os getted");
		__ois = new ObjectInputStream(__is);
		__oos = new ObjectOutputStream(__oos);
		System.out.println("__ois and __oos getted");
	}
}
<p>

上面的代码有什么问题?为什么得不到ObjectInputStream和ObjectOutputStream?

如果各位大大知道答案,请告诉小弟,感激不尽

banq
2006-04-05 13:53
socket读取有两种,1.自己编写循环语句 2.使用NIO

猜你喜欢