我有一个vps,我想安装一个java服务器程序。它包含ssl,但我相信这不是用于java。至少它似乎没有真正加密。 奇怪的是,从ubuntu服务器发送2个字节得到补充,我没有指定,并且一些字节改变。我知道需要知道为什么它不这样做在Windows上,并在我的Ubuntu的vps ... 如果它是不同的如何解决它。是否java在ubuntu和windows上处理数据包的方式不同
我使用printWriter然后刷新到客户端。 和“ISO8859-1”来加密数据包,这些不是字符串或数字只是我发送的普通字节。
protected Socket socket;
protected BufferedReader socketIn;
protected PrintWriter socketOut;
protected LoginServer server;
public static final byte[] LOGIN_SUCCESSBYTE = {(byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00};
this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
this.socketOut.flush();
this.socketOut.write(new String(LoginServer.LOGIN_SUCCESSBYTE,"ISO8859-1"));
this.socketOut.flush();
通过窗口 EC 2C发送4A 00 01 00 02 00 00 00 FF 00 00 00 00 00该分组。,J ..... ........
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ...... ..
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ......
ubuntu发送的数据包
00000000 C3 AC 2C 4A 00 01 00 02 00 00 00 C3 BF 00 00 00 ..,J .... ........
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .... .... ........
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
请给我们的代码。 – 2014-11-08 15:40:19
请包含显示此行为的代码。 – 2014-11-08 15:48:08