st_addr, String schedule, String expire,
int msg_fmt, byte msg_content, String fee_type, String fee_code, String fee_mobile,
String fee_by, int pid)
{
int subRes = -1;
if(!connectStatus || !loginStatus)
return 1;
byte submitData = new byte[264];
setIntData(264, submitData, 0);
setIntData(4, submitData, 4);
setIntData(1, submitData, 8);
servicer_id.getBytes(0, servicer_id.length(), submitData, 12);
submitData[22] = (byte)msg_type;
submitData[23] = (byte)status_report;
if(src_addr == null || src_addr.trim().length() < 1)
return 14;
src_addr.getBytes(0, src_addr.length(), submitData, 24);
if(dest_addr == null || dest_addr.trim().length() < 1)
return 15;
dest_addr.getBytes(0, dest_addr.length(), submitData, 45);
if(schedule != null && schedule.trim().length() > 1 && !setTime(schedule, submitData,
66))
return 16;
if(expire != null && expire.trim().length() > 1 && !setTime(expire, submitData, 70))
return 17;
submitData[74] = (byte)msg_fmt;
submitData[75] = (byte)msg_content.length;
System.arraycopy(msg_content, 0, submitData, 76, msg_content.length);
fee_type.getBytes(0, fee_type.length(), submitData, 236);
fee_code.getBytes(0, fee_code.length(), submitData, 244);
if(fee_mobile != null && fee_mobile.trim().length() > 11)
fee_mobile = fee_mobile.substring(2);
fee_mobile.getBytes(0, fee_mobile.length(), submitData, 250);
fee_by.getBytes(0, 2, submitData, 261);
if(pid < 0 || pid > 256)
pid = 0;
submitData[263] = (byte)pid;
boolean reSend = false;
try
{
out.write(submitData);
out.flush();
}
catch(Exception e)
{
reSend = true;
}
if(reSend)
{
int sendTimes = 0;
do
{
if(sendTimes >= 2)
break;
try
{
connect(default_ip, default_port);
login(default_user, default_password);
out.write(submitData);
out.flush();
reSend = false;
break;
}
catch(Exception exception)
{
sendTimes++;
}
} while(true);
}
if(reSend)
{
connectStatus = false;
loginStatus = false;
return 1;
}
try
{
byte sub = new byte[17];
char sRet = '\0';
int i = 0;
do
{
if(i >= 1500)
break;
if(binput.available() > 0)
{
input.read(sub, 0, 17);
sRet = (char)sub[16];
break;
}
Thread.sleep(10L);
i++;
} while(true);
if(sRet == 'T')
subRes = 0;
else
subRes = 11;
}
catch(Exception e)
{
subRes&nbs