Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a function to send sms with hsdpa gsm, and a function for read recieve sms.
my program run and it works good, but after it sends 6 or 7 sms, my program can't connect to gsm modem.
The error is " port is already in use "
but after I stop it and run it again , it works good again for a few times.
each time these functions (send sms or recieve sms ) run, they open serial port at the first of function and then close the serial port when they finish sending or reading recives sms.
How can I solve this problem ?
Posted
Updated 13-Dec-10 11:55am
v2
Comments
Abdul Quader Mamun 14-Dec-10 7:01am    
Many spelling mistake in the question.

It means that there is another program accsessing your device. If you want to use exclusevely for SMS then do not close port and contiune to use it. Such devices can have only a single port open.
 
Share this answer
 
Comments
Mahnoosh_M 13-Dec-10 13:49pm    
there is no more program access gsm modem .
I check my code,always I close the serial port after I use it.
Saksida Bojan 13-Dec-10 14:07pm    
the error should tell you everything. For some reason the port does not close, if the unseen error occourd there is a possibility that the port wasn't closed. You can try if you get that error message try sending even if port is can not be open or try something like thiss
// Open port
try {
//Some code that sends and then close port
} catch (System:Exception) { // Close port in case it didn't close it }
Please got to http://www.smslib.org for details

Hope you get all your requirement and source code
 
Share this answer
 
v2
can you send your source code to see?
mehrdad.motaghed@gmail.com
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900