Click to See Complete Forum and Search --> : Accessing COM port


Andy Tacker
April 16th, 2003, 06:59 AM
Hi there!
I am working on a service that sends/ receives SMS using GSM/GPRS modem which is attached to COM port.
I cannot get to connect with the PORT...
Does anyone has any idea how to work it out?

MartinL
April 16th, 2003, 09:46 AM
What is the GetLastError() returned code?

pareshgh
April 16th, 2003, 12:19 PM
are you seting the baud rate and initialization parameters properly.

-Paresh

Andy Tacker
April 17th, 2003, 03:24 AM
well, here it is not giving me any errors...
It simply writes port opened Successfully.

now, I am trying to catch any event so, I did DLL import of SetCommMask and WaitCommEvent...

and now it is not catching any event...
as it is a modem, I think I need to send a modem command like
"AT+CMGL=" and should see its result... that'swhat I am doing at the moment...

and when we talk about setting port parametrs, the winapi function needs a DCB structure... hola! I dont really get to know how to pass this structure through C#...

I think C++ was a better way out, but i opt for C#... hope wont have to go back to C++ for writing this service... :-)

thank you folkz for answers... if you have any idea, will be nice to hear...

Andy Tacker
April 24th, 2003, 08:53 AM
Here! I atlast, got to find the solution to this problem.
I hope some other person will be looking for answers to same question... so, here is the link to get some idea about how to do this....

AccessingCOMPorts.html (http://www.codeguru.com/cs_network/AccessingCOMPorts.html)

pareshgh
April 24th, 2003, 01:19 PM
first of all nice picture of yours ;) ;) :D :D :D

actually, you can do much in VC++ directly. but in C# you have to make use of APIs.

I remember , I did that AT + commands in past. it was a good fun to retrive results.

unfortunately I don't have the code snippet right now. but

I would point you an example,

SerialStream (http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=fcba7fc5-666e-4eb0-863f-0045b0c79ec7)

Which is very known example and you can do stuffs like

read buffer,
write buffer,
open ports etc.
In fact you can send all of the AT+CMGL and all commands.

hope this helps though,
Paresh

Andy Tacker
April 28th, 2003, 06:08 AM
Yes Paresh!

I had been working in C++ for quite a long time. but lately, the people here in company started to think about using latst .NET Technology.

As far as my personal opinion, it would have been fun and quite an easy job to MOULD this pretty good project in C++.

Anyways, thanks for replies and the link.

pareshgh
April 30th, 2003, 06:24 PM
yeah ! Everywhere I see is Just .NET nothing else.

Anil Belankar
June 30th, 2003, 01:06 AM
Hi,
I will be greatful if I can get the VC++ code for communicating with GSM modem as soon as possible.It is urgent. Thanks in advance.

cheepink
June 30th, 2003, 08:55 PM
Originally posted by Anil Belankar
Hi,
I will be greatful if I can get the VC++ code for communicating with GSM modem as soon as possible.It is urgent. Thanks in advance.

-> What port(Com/USB etc) do you use?

Transporter
January 18th, 2005, 10:56 PM
-> What port(Com/USB etc) do you use?

USB please ...

darwen
January 20th, 2005, 08:52 AM
Do you want fries with that ? :D

Darwen.