Created
November 22, 2012 12:20
-
-
Save germanescobar/4130882 to your computer and use it in GitHub Desktop.
SMPP Server Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyPacketProcessor implements PacketProcessor { | |
@Override | |
public void processPacket(SmppRequest packet, ResponseSender responseSender) { | |
if (packet.isBind()) { | |
// check the credentials and return the corresponding SMPP command status | |
Bind bind = (Bind) packet; | |
responseSender.send( Response.OK ): | |
} else if (packet.getCommandId() == SmppPacket.SUBMIT_SM) { | |
// a message has arrived, what do you want to do with it? | |
SubmitSm submitSm = (SubmitSm) packet; | |
responseSender.send( Response.INVALID_DEST_ADDRESS ); // just an example | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SMPPServerExample { | |
public static void main(String[] args) { | |
SmppServer server = new SmppServer(4444); | |
server.setPacketProcessor(new MyPacketProcessor()); | |
server.start(); | |
System.out.println("Press enter to stop the server ..."); | |
Scanner keyboard = new Scanner(System.in); | |
keyboard.nextLine(); | |
server.stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to send delivery receipt to user?