sending SMS from GSM Modem using port number + smslib API
Hi frndz
I want to send an SMS to a particular port number using GSM modem
I found SMSLib API which allows you to send an SMS to a specific port number
I tried the API and use the following code to send an SMS
but It gives me error on connection with the GSM Modem
thanks
alpesh
The Code is:
import org.smslib.*;
public class SendMessage
{
public static void main(String[] args)
{
CService srv = new CService("COM1", 9600, "", "");
try
{
srv.setSmscNumber("");
srv.connect();
COutgoingMessage msg = new COutgoingMessage("+919819378550", "add$A0005$Hypercity - Malad");
msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
msg.setStatusReport(false);
msg.setValidityPeriod(8);
msg.setSourcePort(9555);
msg.setDestinationPort(9555);
srv.sendMessage(msg);
srv.disconnect();
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Error"+e);
}
System.exit(0);
}
}
[1092 byte] By [
alpesha] at [2007-11-26 12:47:00]

# 2
I has this error:
Exception in thread "main" java.lang.NoClassDefFoundError: gnu/io/SerialPortEven
tListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.smslib.CService.<init>(CService.java:79)
at SendSMS.main(SendSMS.java:15)
Press any key to continue...
this is to download my project (by Jcreator). helpe me!
http://www.fileden.com/files/27548/upload/MyProject.zip
# 4
Hi alpesh!
I'm using this tools to send out SMS from PC:
- GSM modem: Wavecom Fastrack (http://www.mobitek-system.com/Wavecom/Fastrack.html)
- API: SMS API (http://www.mobitek-system.com/SMS_Gateway/SMS_API_version3_Manual/index.html)
- VB6
I haven't try the SMS API with Java even though there's a way to do it by using Jawin (http://www.mobitek-system.com/SMS_Gateway/SMS_API_version3_Manual/java.htm).
Check the following when using GSM Modem:
- baud rate
- COM port
- ensure SIM lock is disable
- ensure SIM has credit balance (if using prepaid)
- network signal is strong
Good luck!