急求一个手机短信java发送程序
来源:百度知道 编辑:UC知道 时间:2024/09/12 20:17:39
Java串口访问控制短信猫发送短信
import java.io.*;
public class CommTest
{
static CommPortIdentifier portId;
static Enumeration portList;
static int bauds[] = { 9600,115200 ........};
public static void main(String[] args)
{
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
{
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
{
System.out.println("Found port: " + portId.getName());
for (int i = 0; i < bauds.length; i++)
{
System.out.println("Trying at " + bauds[i] + "...");
SerialPort serialPort = null;
try
{
InputStream inStream;
OutputStream outStream;
int c;
String response;
serialPort = (SerialPort) portId.open("SM