Introduction & A Quick Big Doubt
Dear All,
I am new here, i have started learning java directly just since over a week, i got my interest in Java from knowing about applications and things "My Name is James Joseph" and please find below a sample code, i need you guys advice on!
Code:
public void bind() {
debug.enter(this, "SMPP.bind()");
try {
if (bound) {
this.unbind();
return;
}
BindRequest request = null;
BindResponse response = null;
String syncMode = "a";// (asynchronous ? "a" : "s");
// type of the session
syncMode = "a";//getParam("Asynchronous/Synchronnous Session? (a/s)", syncMode);
asynchronous = false;
// input values
bindOption = "t";// getParam("Transmitter/Receiver/Transciever (t/r/tr)", bindOption);
request = new BindTransciever();
ipAddress = ipAddress;
port = port;
TCPIPConnection connection = new TCPIPConnection(ipAddress, port);
connection.setReceiveTimeout(20 * 1000);
session = new Session(connection);
systemId = systemId;
password = password;
// set values
request.setSystemId(systemId);
request.setPassword(password);
request.setSystemType(systemType);
request.setInterfaceVersion((byte) 0x34);
request.setAddressRange(addressRange);
// send the request
System.out.println("Bind request " + request.debugString());
if (asynchronous) {
pduListener = new SMPPTestPDUEventListener(session);
response = session.bind(request, pduListener);
} else {
response = session.bind(request);
}
logger.info("Bind response " + response.debugString());
if (response.getCommandStatus() == Data.ESME_ROK) {
bound = true;
}
} catch (Exception e) {
event.write(e, "");
debug.write("Bind operation failed. " + e);
System.out.println("Bind operation failed. " + e);
// return "Error-" + e.getMessage();
} finally {
debug.exit(this);
}
}
Now the problem is, how do i change it to String the bind function ? and get its response? for a newbie to java this is too big of an advanced problem! would take any positive and negative advice ) i tried a lot but the whole app would give errors :(