关于Socket编程的输入流(高手来啊)
程序如下:
Socket socket = new Socket(host,port);
InputStream is = socket.getInputStream();
int c = 0;
StringBuffer sb = new StringBuffer();
while((c = is.read()) != -1) {
sb.append((char)c);
}
System.out.println("receive string is " + sb.toString());
程序运行不到System.out.println("receive string is " + sb.toString());
好象在is.read()的时候就不动了。
这段程序代码InputStream要读取以下内容(我用sniffer截取的数据)
01 5e 09 d5 bc 32 98 79 5c f0 00 0a 50 10 43 cd 7c 08 00 00