Home Answers Viewqa Java-Beginners receive message from mobile to java program

 
 


anand sp
receive message from mobile to java program
0 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners

i got a code to receive message....but wen i receive it its showing a string which is not readable... if possible please edit dis code to retreive the origianl string message.... here is the code import java.io.*; import java.util.*; import javax.comm.*;

public class SimpleRead implements Runnable, SerialPortEventListener { static CommPortIdentifier portId; static Enumeration portList;

InputStream inputStream;
SerialPort serialPort;
Thread readThread;

public static void main(String[] args) {
    portList = CommPortIdentifier.getPortIdentifiers();

    while (portList.hasMoreElements()) {
        portId = (CommPortIdentifier) portList.nextElement();
        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
             if (portId.getName().equals("COM3")) {
        //                if (portId.getName().equals("/dev/term/a")) {
                SimpleRead reader = new SimpleRead();
            }
        }
    }
}

public SimpleRead() {
    try {
        serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
    } catch (PortInUseException e) {System.out.println(e);}
    try {
        inputStream = serialPort.getInputStream();
    } catch (IOException e) {System.out.println(e);}
try {
        serialPort.addEventListener(this);
} catch (TooManyListenersException e) {System.out.println(e);}
    serialPort.notifyOnDataAvailable(true);
    try {
        serialPort.setSerialPortParams(9600,
            SerialPort.DATABITS_8,
            SerialPort.STOPBITS_1,
            SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {System.out.println(e);}
    readThread = new Thread(this);
    readThread.start();
}

public void run() {
    try {
        Thread.sleep(20000);
    } catch (InterruptedException e) {System.out.println(e);}
}

public void serialEvent(SerialPortEvent event) {
    switch(event.getEventType()) {
    case SerialPortEvent.BI:
    case SerialPortEvent.OE:
    case SerialPortEvent.FE:
    case SerialPortEvent.PE:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
        break;
    case SerialPortEvent.DATA_AVAILABLE:
        byte[] readBuffer = new byte[20];

        try {
            while (inputStream.available() > 0) {
                int numBytes = inputStream.read(readBuffer);
            }
            System.out.print(new String(readBuffer));
        } catch (IOException e) {System.out.println(e);}
        break;
    }
}

}

View Answers









Related Pages:
receive message from mobile to java program
receive message from mobile to java program  i got a code to receive message....but wen i receive it its showing a string which is not readable... if possible please edit dis code to retreive the origianl string message.... here
java program to exchange soap message
that how can I write the server side program in order to receive the message...java program to exchange soap message  Hi Friends, I want... a set of 15 parameters and program on web server side receives this 15 parameters
VoIP Mobile
completed the first successful transmission of a call from a mobile VoIP..., you'll be able to make unlimited calls from your mobile phone as well. U.S.-based... market Java-phones, as well as high-end smart phones, to place and receive
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format... sample program to understand. Thanks in advance. Regards, Lisha Ahuja
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format... sample program to understand. Thanks in advance. Regards, Atul Patil
send sms from pc to mobile
send sms from pc to mobile  java program to send sms from pc to mobile
How to send message in struts on mobile - Struts
How to send message in struts on mobile  Hello Experts, How can i send messages on mobile i am working on strus application and i want to send message from jsp
send sms from pc to mobile via gsm modem in java
..... can u pls help me to retrieve message from mobile to java program... import...send sms from pc to mobile via gsm modem in java  pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA
How to easily send and receive recorders from database (in AJAX)?
How to easily send and receive recorders from database (in AJAX)?   Hi all, I have a question, iam working in JAVA web application and can somebody please explain or give me an example how to send and receive recorders from
receive a ResultSet from a stored procedure
receive a ResultSet from a stored procedure  How do I receive a ResultSet from a stored procedure
A Message-Driven Bean Example
the Java Message Service (JMS) technology. Message-driven beans have.... A single message-driven bean can process messages from multiple... Application Server resources. JMS: The Java Message Service (JMS) is an API for Java
Message Driven Beans
that uses it to send the message to or to receive the message from. Point... sending messages. Thus the message senders are decoupled from consumers. Reliability... SonicMQ are the examples of MOM based architecture.  Java Message Services (JMS
A Message-Driven Bean Example
the Java Message Service (JMS) technology. Message-driven beans have... they are stateless. A single message-driven bean can process messages from... Application Server resources. JMS: The Java Message Service (JMS) is an API for Java
Ejb message driven bean
.style1 { color: #FFFFFF; } Ejb message driven... you the process which are involved in making a message driven bean using EJB...; For developing the message driven bean we are using both the EJB module and web
Java Message Service(JMS)
Java Message Service(JMS)       JMS (Java Message Service) is a Java API that allows java... queue and a consumer gets messages from the queue. Only one consumer
Mobile Commerce,M-Commerce Services,Mobile Commerce in India,Advantages and History of Mobile Commerce
voice calling or via Short Message Services (SMS) services. WAP based mobile... most from mobile commerce. M-Commerce has proved a major boon for these sectors.... The assumption of mobile commerce is not so young as it mushroomed so early from
how to delete a jar file from mobile by using j2me program.
how to delete a jar file from mobile by using j2me program.  When i'll update a new version jar in mobile. Then i want to delete that old jar which is previously present in mobile. How to do
Multicast Client in Java
to send and receive the IP packet or message by multicast client. Here, we provide... UDP Multicast Client in Java   ... at a time. The detail information provides bellow: Description of program
Design and develop message-driven EJBs
of the arrival of a Java Message Service (JMS) message. The listener manager... as an asynchronous messages is delivered from JMS. Once the message arrived on the queue, the EJB cannot wait to receive a JMS message
Message Driven Beans
that uses it to send the message to or to receive the message from. Point... sending messages. Thus the message senders are decoupled from consumers. Reliability... SonicMQ are the examples of MOM based architecture.  Java Message Services (JMS
Libraries to send or receive packets of data
Libraries to send or receive packets of data   Can i know which is the best library that can be used to transmit or receive data packets from device to device. i have tried jpcap but that cannot be used to receive or transmit
error message - Java Beginners
;Hi friend, To compile and run a java program we need to install java...error message  sir, while i m trying to execute my first program(print my name)I get error message like" javac is not recognized as internal
Reading message using Java Mail
Reading message using Java Mail       This Example shows you how to read message using javamail... used in the program. System.getProperties() this method get the 
How to Print a Stack Trace Message
How to Print a Stack Trace Message  Debugging of Java program requires... times you have to print the detailed error message on the console... will print the detailed message on the console. You can use
Construct a DatagramPacket to receive data
Construct a DatagramPacket to receive data  ...) method for creating a datagram packet to receive data...; System.out.println("Datagram packet receive.");  
Java Message Services
Java Message Services      ... for developing programs using it. The java message services API is a java Message oriented... to a particular queue and a consumer reads message from the queue. The point-to-point
Find Your Way with a Map Mobile Application
Find Your Way with a Map Mobile Application Keeping tabs on how to get from one place to another is important to do. This is why a map mobile application... work with even more functionality with a map mobile application. This comes from
Example of printing Text message passed from XML to JSP
Example of printing Text message passed from XML to JSP... are going to know how we can pass a text message from XML to JSP.  ... with a JSP page. This tutorial is only geared towards showing how to construct a Java
how to establish connection b/w java app and mobile phone
how to establish connection b/w java app and mobile phone  hello... to send SMS from our phone to a java application situated on a remote server... i.e.., we don't know how to send and receive SMS to java server.We don't know what
Sending and receiving information to the UDP Client in Java
will provide send and receive information by the UDP client in Java. UDP client sends information or messages to UDP server and it collects some messages from... Sending and receiving information to the UDP Client in Java
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)  How to send and receive a msg from jsp servlet program to mobile phone using gsm vodafone... completed. so i requested to you pls answer my question. My project name is MOBILE
to retrieve message body - Java Beginners
to retrieve message body  hi, Using dbfile system to store message using mysql. dbfile system is to store headers in database and message body in file system . i retrieved message contents like from :, to :, delivered
Ejb message driven bean
;By Entity class we mean a java class that represent table from the database... Ejb message driven bean       This tutorial explains you the process which are involved in making a message
retrieve message contents - Java Beginners
retrieve message contents   hi , dbfile system to store message headsers in mysql database and message contents in file system . how to retrieve message contents. thanks bala..   Hi friend, Content
Mobile Application Development
multiuser mobile games We develops server program and mobile games...Mobile Application Development The Mobile Application Development is specified... the application for various mobile devices. Due to low processing and memory power
Multicast Server in Java
Multicast Server in Java       This section introduces how to receive... of multicast server through program. A brief description is given bellow. 
Java Program
Java Program  A Simple program of JSP to Display message, with steps to execute that program   Hi Friend, Follow these steps: 1)Go... language="java"%> <%String st="Hello World"; %> Message is <%=st%>
Sending message using Java Mail
Sending message using Java Mail        This Example shows you how to send a message using javamail api. A client create new message by using Message subclass
Compiling and Running Java program from command line
Compiling and Running Java program from command line - Video tutorial that explains you all steps necessary to compile and run the Java program from dos... of compiling and running java program from command line. We have also video
Java Program - Swing AWT
Java Program  A Java Program to send message from one computer to another
Java Program - Swing AWT
Java Program  A java Program that send message from one computer to another and what are the requirements
java program - Java Beginners
java program  1.write a program to show traffic signal using multithreading. 2.Except an integer from 1-12 and display corresponding month. if the integer is not between 1-12 then give the errer message and promit
How to netbean mobile application - MobileApplications
application interface and populate my mobile application interface with datas from my...How to netbean mobile application  Hello, i am recently working on a mobile application, i like to knw how i can connect my mobile application
Mobile Software Testing Services, Mobile Application Software Testing Service RoseIndia
have a strong network of mobile software testers, a different team from our... from computer software testing and it requires special skills, as mobile... mobile software testing according to the type and version of software like Java
Getting message from the server using RPC( Remote Procedure Call )
Getting message from the server using RPC( Remote Procedure Call... describes the procedure of retrieving message from the server via RPC. The steps involved in geting message from the server are described below:- Step1:-Right
how to send sms from my website to mobile of particular user.
how to send sms from my website to mobile of particular user.  i had... with their mobile number daily one health tip is to sent to their respective mobiles.. so can u tell the process and how to implemnt this using java
mobile banking login program
mobile banking login program  static Display dis; static Login destroy; public Login() { dis=Display .get Display(this); } public void startApp() { destroy=this; LoginScreen
sms from pc to mobile
sms from pc to mobile  Sir I am developing a website and i need a code to send sms on any mobile from the wbesite.pls help me. thanx in advance
sms from pc to mobile
sms from pc to mobile  Sir I am developing a website and i need a code to send sms on any mobile from the wbesite.pls help me. thanx in advance
How to send sms alerts to mobile using java?
How to send sms alerts to mobile using java?  Hi i have used the Code to send message on mobile using java code, it is not working - COM2...=" + 9100000000"; // the message center and also how this code is working