Hi,
I am new to Thales Simulator. I am trying to send a message to Thales Simulator console using my java code. Problem is it is connected and all but i am not getting any response back from Thales Simulator in my java code.
Do i need to do any additional configuration while setting up the Thales Simulator library?
Below is the code i have picked up from one of the discussion threads.
package thales;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;
public class TestHSMJava {
public static void main(String args[]) {
}
Regards,
Amrutansu
I am new to Thales Simulator. I am trying to send a message to Thales Simulator console using my java code. Problem is it is connected and all but i am not getting any response back from Thales Simulator in my java code.
Do i need to do any additional configuration while setting up the Thales Simulator library?
Below is the code i have picked up from one of the discussion threads.
package thales;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;
public class TestHSMJava {
public static void main(String args[]) {
System.out.println("<<< Main Method Entry >>>");
String command = null;
Socket socket = null;
DataOutputStream out = null;
DataInputStream in = null;
byte[] b= new byte[100];
try {
socket = new Socket("localhost", 9997);
System.out.println("<<< Socket >>> :" + socket);
if (socket != null) {
System.out.println("<<< Connected to HSM >>>:"
+ socket.isConnected());
in = new DataInputStream (new BufferedInputStream(socket.getInputStream()));
out = new DataOutputStream (new BufferedOutputStream(socket.getOutputStream()));
command = "000b3030303041303030303255";
out.writeUTF(command);
System.out.println("Input to HSM : " +command);
out.flush();
String response = in.readUTF();
System.out.println("Output from HSM : " +response);
System.out.println("");
}
}
catch(Exception exception){
System.err.println("exception...exception : "+exception.getMessage());
}
finally{
System.out.println("Complet..now get out");
}
}}
Regards,
Amrutansu