Dear all,
I used your code to develop my window service . My service will send SMS automatically every 2 minutes (using 2 GSM Modem at the same time). It works so good about 10 messages , then the error ("Port is already open or No Phone Connected") often appears . I used an database to control "Sent Message"(MO table) and "Received Message"(MT table) . I don't know how to solve this issue . Please help me as soon as possible . My nickname in yahoo : eternal_loving190@yahoo.com.vn . Thanks a lot !!! This is a part of my code :
....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using GsmComm.GsmCommunication;
using System.Diagnostics;
using System.Web;
using System.Threading;
using GsmComm.PduConverter;
using System.IO;
}
catch (Exception ex)
{
EventLog e = new EventLog("Application", System.Environment.MachineName, "VinaPhone_Port");
e.WriteEntry(ex.Message, EventLogEntryType.Error);
e.Close();
}
CommSetting.comm.Close();
}
private static bool EnterNewSettings(int newPort, int newBaudRate, int newTimeout)
{
int Port;
int BaudRate;
int Timeout;
try
{
Port = newPort;
}
catch (Exception)
{
EventLog e = new EventLog("Application", System.Environment.MachineName, "InvalidPort");
e.WriteEntry("Invalid port number", EventLogEntryType.Error);
e.Close();
return false;
}
Please try one thing
1) Open and Close the Com port immediately after the use.
You told your service will send SMS automatically every 2 minutes , then do open the connection send SMS and then close it.
Hi,
I can send message and it works fine but when i try to read message, it gives me following error:
"Phone reports generic communication error or syntax error"
This article project sample wont work with bluetooth.
It works with GSM modem / GSM phone connected to your system through Serial cable. Try connecting GSM modem/phone with serial cable. You will get USB to Serial Cable through which you can connect your phone and try.
If any issues , you are pleased to send me a query.
Thank you so very much Ranjan. I have E71 phone which I connect through USB port of my laptop. I do not know how to make it COM port which I need to use in order to run your application. Bluetooth port appears as COM so it works.
Any idea how can i make my USB connection to phone as COM port??
Sorry Ranjan for bothering you for small issue as before...It was nonsense mistake from my and no I can connect my E71 phone to COM port using USB cable. I am able to send message but when i read message, it gives me error dialog box saying "Phone reports generic communication error or syntax error".
Any idea how to fix it?
Try whether you can read SMS using AT commands with Windows - Hypertermial software.
If there;s no issue in reading SMS with hyper terminal then will see what next to do.
Hi
I also get the "Phone reports generic communication error or syntax error" messages when I try to read messages from the phone. How do I try AT command??
1)You can check whether its possible to connect to your mobile through Windows->HyperTerminal communication program.
if connection is sucessfull then follow the below steps
1) To Check whether your phone understands AT Commands
the below command you need to specify in Hyperterminal , if your phone supports AT COmmands then it should respond properly
To test the communication between PC to GSM modem whether it’s for Sending / Receiving SMS you can use the use the command AT, inturn the GSM modem should respond with OK
command: AT
response: OK
Read SMS based on status
AT+CMGL="REC UNREAD"
The GSM/GPRS modem or mobile phone should return something like this:
+CMGL: 1,"REC UNREAD","+919900227451",,"07/02/18,00:05:10+32"
Reading text messages is easy.
+CMGL: 2,"REC UNREAD","+919900227451",,"07/02/18,00:07:22+32"
A simple demo of SMS text messaging.
I try to use a Nokia E65. This phone seams to have AT problems!
I shift to a Nokia 6230i. There it works.
Best wishes
Ruben</blockquote>
Hi i am using a Nokia N95 and i am unable to recv messages using the .net application. The application throws an exception at comm.EnableMessageNotifications().
You can modify this article code for asp.net application to send/receive SMS. I left my previous company where I used GSM modem to send/receive SMS ,so now am unable to test. any ways when I was in my previous company I created a Webservice to send SMS. Dont worry a small modifications u have to do, sure it will work.
Hi,
I need C# source code for sending and receiving SMS using GSM Modem.
and necessary things.It's urgent for me.
send to my mail id : ravi_pinnoju@yahoo.co.in
Regards,
Ravi
The given code is sending the SMS perfectly but when i read the sms its not showing any sms and show "0 messages read." either its not showing any message when sms received. however sim shows the messages when i use AT commands on Hyperterminal. i am using a GSM Modem with serial port.
can you please resolve this issue. i'll b really thankful to you.
Try to find out what all things happens inside
with GSMComm's logging mechanism by handling LoglineAdded event. I posted a snippet in this forum messages.
i am using visual studio 2005 version 8.0.50727.42
.NET framework version 2.0.50727
when i modified ranjans source code, i am getting an FileNotFoundException saying
Couldnot load file or assembly 'RS232,Version=1.24.0.0,Culture=neutral,PublickeyToken=515d87df384dc81 or one of its dependencies.The system cannot find the file specified.
i downloaded your source code and also GSMComm library.
i am able to send messages.
i am able to read all messages from SIM
i am not able read messages from PHONE option.
In the function "private void ShowMessage(SmsPdu pdu)" i added a catch block for the "received message" part and then
i commented the line "BindGrid(pdu)", then i was able to read all messages from the PHONE with one or more lines missing in some messages.(I feel that there is problem with "UserDataText", Does the problem lie in the "DataCodingScheme property"). To better explain i would give you a sample of output i got.
Sample output
Message status = Read, Location = ME/1
RECEIVED MESSAGE
Sender: Airtel
Sent: 28/07/2007 21:11:41 +0530
-------------------------------------------------------------------
Message status = Read, Location = ME/2
RECEIVED MESSAGE
Sender: +919600393030
Sent: 08/12/2008 12:02:09 +0530
Message text: Why my reg no
-------------------------------------------------------------------
Message status = Sent, Location = ME/3
SENT/UNSENT MESSAGE
Recipient: +919600393030
Message text: I heard ur result is out
-------------------------------------------------------------------
It is very clear that some lines are missing because they are throwing some exception.
Will "ServerMain.cs" receive messages that are unread, once they are received at the modem side. I think the MessageReceived() function is not being called the moment messages are received.
Please kindly figure out the problem. I am really working on it.
I will be more than happy to see you reply. If you need more info please do let me know.
i am using sony ericsson W700i. i am very glad to inform that i am able to send message using my cell as GSM modem. But my application requires to get activated only on receiving a PARTICULAR message. Could you kindly help me out.
i downloaded ur source code and started running it.i am able to read messages from my SIM but not from my phone. when i request to read message from phone , it says "The value 18 is not part of the 7-bit default alphabet extension table"
You can use this code for your phone. But Serial signal dont correct with W700i. If you want test this code , you use DKU5 cable and connect with COM port.
Some phone as W700i can send with SMS but it use USB cable and dont correct as serial cable. If you get any problem, please tell me.
Thanks,
Last Visit: 31-Dec-99 18:00 Last Update: 25-Sep-24 9:21