串行化问题,急问,在线等
class CServerLink
{
private int nPort;
public static Socket soc;
public static InputStream sin;
public static OutputStream sout;
public static InputStream cryptin;
public static OutputStream cryptout;
public static ObjectInputStream ois;
public static ObjectOutputStream oos;
public CServerLink(int np)
{
nPort = np;
}
public void getLinked()
{
try
{
byte[] desKeyData = {(byte)12, (byte)251, (byte)53, (byte)63, (byte)98, (byte)93, (byte)12, (byte)45};
SecretKey privateLib = new SecretKeySpec(desKeyData, "DES");
Cipher cip = Cipher.getInstance("DES");
Cipher cipd = Cipher.getInstance("DES");
cip.init(Cipher.ENCRYPT_MODE, privateLib);
cipd.init(Cipher.DECRYPT_MODE, privateLib);
soc = server.svrsoc.accept();
System.err.println("get Linked");
sin = soc.getInputStream();
sout = soc.getOutputStream();
cryptin = new CipherInputStream(sin, cipd);
cryptout = new CipherOutputStream(sout, cip);
ois = new ObjectInputStream(cryptin);
oos = new ObjectOutputStream(cryptout);
System.err.println("Here is arrived!");
}
catch(Exception e){};
}
}
语法上编译通过,但是运行到ois = new ObjectInputStream(cryptin);oos = new ObjectOutputStream(cryptout);时候卡住了。
哪为帮我一下。