我有问题。我正在开发一个连接到C ++服务器的applet。出于某种原因,当我在新的IE8窗口中启动第二个小程序时,我无法写入,但我仍然可以阅读。转到第二个客户端小程序的任何文本都没有通过。我为我的applet签了jar文件,可以用IE8运行它。我正在使用带有JCreator的Windows 7 for Java。任何建议将不胜感激。
<html>
<head>
</head>
<body bgcolor="000000">
<center>
<applet
archive="javafree.jar"
code="javafree.class"
width="800"
height="500">
<param name="player" value="scar" />
</applet>
</center>
</body>
</html>
socket = new Socket( "localhost", 4000 );
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintStream( socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(classlink.socket.getInputStream()));
if( in.ready() ) {
gametext += "<br><font color='#7DE5FF'>" + in.readLine() + "</font><br>";
classlink.textman.setText(gametext);
}
答案 0 :(得分:0)
您显然会使用与此套接字无关的内容覆盖您的输入流(classlink
建议使用类级别,静态?):
in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
...
in = new BufferedReader(
new InputStreamReader(
classlink.socket.getInputStream()));