1.用BufferedWriter封装的流对象在写入后,如果不FLUSH的话,是否对方端会接收到?是否一定要FLUSH?
2.用BufferedReader封装的套接字流再read的时候,在对方什么的条件下会触发读操作从阻塞状态转为开始读取?怎么判断对方已经写入完该报文?对方写完后一般流会有什么状态来判断对方已经写完?谢谢!
以上为C与JAVA之间通信!谢谢!
2.用BufferedReader封装的套接字流再read的时候,在对方什么的条件下会触发读操作从阻塞状态转为开始读取?怎么判断对方已经写入完该报文?对方写完后一般流会有什么状态来判断对方已经写完?谢谢!
以上为C与JAVA之间通信!谢谢!
解决方案 »
- 数组对象有点迷惑了
- 控件使用异常:component must be showing on the screen to determine its location
- 为什么会出现异常?
- 高手呢!
- JSP在tomcat上的报错信息是怎么回事?WIN2003SVR环境下!!!
- 有没有简单一点的数字签名?
- swing编程问题:如何让JMenuBar下的JMenuItem被选中后变灰,不能再选,或者是使用其它类?
- jbuilder中如何编程实现声卡发声
- JB中用了个JWindow,向里面加了panel和label,但为什么显示不了?
- java 2 中的加解密技术
- JNI的问题
- 反编译得到的文件,怎样组装成可以使用的代码
2、read 时本身就已经处于阻塞状态,只有当读满缓冲区或读到文件尾时才会退出阻塞状态。返回 -1 表示已经读取了全部内容。
第二个问题:用ready方法,用法如下。
ready
public boolean ready()
throws IOException
Tell whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready. Overrides:
ready in class Reader
Returns:
True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
Throws:
IOException - If an I/O error occurs
要么就是对方关闭,肯定发完(不过这样做不好)还有就是java 1.4后有NIO里的socket可以判断现在socket能读还是能写,自己去看看吧