Hi all!!! I am working on a project in which i need to built a j2ee application that gives sms services. In this application i need to write a servlet ahich contnuously runs n background listening to the port that is connected to the mobile. after a message is recieved the event should be notified to the servlet and the servlet should respond by sending the appropriate reply to that mobile number.
My first problem is how do i keep the servlet running in the background once i have started my web application.....
That's not what servlets are for - they follow the HTTP request/response mechanism.
If you want to handle some other protocol or port, start a separate thread (in a ServletContextListener) that handles the connection.
Joined: Mar 31, 2010
actually my mobile is connected to com8 port . and i need to be notified when a sms comes so that i can reply it.
I am using at commands for it.
as the application is in j2ee, i need to write a servlet for that purpose. this servlet wil be the part f my whole website.
I am driven nuts, am not able to resolve the problem
Ya thanks himanshu. i read the tutorial. i know the socket programming. I am developing the web application only.
actually my mobile is connected to port com8. a web application is there that gives sms services. i have used mobile to send messages and receive messages.
The mobile is interfaced with com8 port.
I want a jee application that will hear that port and transfer the sms recieved to "SendSms" servlet which will further respond to the request.
If i use the local java program i wont be able to continue with my web application.
Joined: Mar 31, 2010
Ulf Dittmer wrote:
Is it possible that the listener will continuously run in background and then notify on receiving the sms.
Are you certain that an SMS sent by the mobile would go out to the COM port? I'd think that it goes out over the air.
Actually, a mobile is connected to the port. It is used both for sending as well as replying for the sms.
This is the logic for reading the sms from the port....
I need to run this code to be run continuously in the background or atlleast invoked when some message is received.