2016-06-30 8 views
1

мне было дано:Я пытаюсь подключиться к серверу smpp! Я получаю таймаут соединения исключение

[SMPP - 82.114.166.86:5016] SMPPVersion=v3.4 
UserName=YBB Password=Y2b1B3 SenderAddress=SBYB 

Я пытался подключиться к серверу SMPP, но получаю исключение тайм-аута.

+3

Нет необходимости публиковать IP/порт вашего сервера. – Sevle

+0

Но когда я попытался соединиться этим кодом, я получаю исключение таймаута соединения –

+0

Просьба дать предложения –

ответ

1

общественного класса Test {

private static TimeFormatter timeFormatter = new AbsoluteTimeFormatter(); 

; 

public static void main(String[] args) { 
    SMPPSession session = new SMPPSession(); 
    try { 
     session.connectAndBind("smsmersal.net", 8080, new BindParameter(BindType. 
       BIND_TX, "YEMENSOFT", "m6373", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null)); 
    } catch (IOException e) { 
     System.err.println("Failed connect and bind to host"); 
     e.printStackTrace(); 
    } 

    try { 
     String messageId; 
     messageId = session.submitShortMessage("CMT", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "yet-ysoft", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, "967739873913", new ESMClass(), (byte) 0, (byte) 1, timeFormatter.format(new Date()), null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte) 0, new GeneralDataCoding(false, false, MessageClass.CLASS1, Alphabet.ALPHA_DEFAULT), (byte) 0, "jSMPP simplify SMPP on Java platform".getBytes()); 
     System.out.println("Message submitted, message_id is " + messageId); 
    } catch (PDUException e) { 
     // Invalid PDU parameter 
     System.err.println("Invalid PDU parameter"); 
     e.printStackTrace(); 
    } catch (ResponseTimeoutException e) { 
     // Response timeout 
     System.err.println("Response timeout"); 
     e.printStackTrace(); 
    } catch (InvalidResponseException e) { 
     // Invalid response 
     System.err.println("Receive invalid respose"); 
     e.printStackTrace(); 
    } catch (NegativeResponseException e) { 
     // Receiving negative response (non-zero command_status) 
     System.err.println("Receive negative response"); 
     e.printStackTrace(); 
    } catch (IOException e) { 
     System.err.println("IO error occur"); 
     e.printStackTrace(); 
    } 

    session.unbindAndClose(); 
} 

}

+0

Пожалуйста, помогите мне в этом –