1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
package my.smssender.pck;
import ie.omk.smpp.Connection;
import ie.omk.smpp.event.ConnectionObserver;
import ie.omk.smpp.event.SMPPEvent;
import ie.omk.smpp.message.SMPPPacket;
import java.io.IOException;
import java.net.UnknownHostException;
import java.io.*;
public class Connect extends Thread implements ConnectionObserver {
private String ipAdress;
private int port;
private Connection conn;
private String sysId;
private String password;
public Connect () {
ipAdress = "100.80.0.100";
port = 5016;
sysId = "admin";
password = "good";
}
public void connectionEstablish() throws IOException {
try {
conn = new Connection (ipAdress, port, true);
conn.addObserver(this);
}
catch(UnknownHostException uhe) {
System.out.println("connection failed");
System.exit(0);
}
}
public void binding() throws IOException {
boolean state = conn.isBound();
conn.bind(Connection.TRANSCEIVER, sysId, password, null);
if (state = true) {
System.out.println("binding succed");
}
else {
System.out.println("binding failed");
}
}
public void packetReceived(Connection conn, SMPPPacket pack) {
}
public void update(Connection arg0, SMPPEvent arg1) {
throw new UnsupportedOperationException("Not supported yet.");
}
} |
Partager