13 Replies - 1048 Views - Last Post: 06 December 2013 - 01:49 PM Rate Topic: -----

#1 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Controlling a C# application with SMS messages

Posted 28 November 2013 - 03:23 PM

Hello everyone, I have an interesting question for you all. I am working on a C# project and I would like to be able to control it using SMS messages containing keywords. I don't know if you have ever seen anything like this but I know there are programs out there that you can control for example by sending "STOP" in a text message to a certain number, to stop the program. This is just an example though.
Anyway, I have done some searching around and I have found several topics that explain how to send SMS messages from C#, mostly using either an online service, or something called a GSM Modem (which I only understand the basics of). But so far I have not found anywhere that explains how to receive a message and interpret it with a C# program. Do you have any idea where to begin on this? Thanks so much in advance for any help!

Is This A Good Question/Topic? 0
  • +

Replies To: Controlling a C# application with SMS messages

#2 astonecipher  Icon User is offline

  • D.I.C.
  • member icon

Reputation: 768
  • View blog
  • Posts: 3,358
  • Joined: 03-December 12

Re: Controlling a C# application with SMS messages

Posted 28 November 2013 - 03:33 PM

I have seen a masters level project where a phone was hooked vie USB cable to the computer for this. And a serial cable to an arduino Board to control various things.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: Controlling a C# application with SMS messages

Posted 28 November 2013 - 08:52 PM

If you search, there are tutorials on:
- how to receive SMS messages on an Android phone
- how to send/receive data via USB cable attached to the phone
- how to read USB port data on a PC using C#

If you combine those three pieces, you are golden.

Personally, I would start with a C# program that just uses tweets or IRC chats.
Was This Post Helpful? 0
  • +
  • -

#4 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:12 PM

Thank you both for your replys!
So Skydiver, let me see if I understand what you mean here. Your suggestion is to simply use an Android phone hooked to a computer to receive the message, then transfer it through a USB cable to the computer, and then the C# application will read the data coming in on the USB? If I understand that right, it sounds about like what I am looking for. However, I have to wonder how you could scale that up if the need arises to handle a lot of traffic. Perhaps that is where you would bring in something like a GSM Modem.
I will have to do some more research on this, but I have one more question for you Skydiver. I don't think I understood what you mean by a C# program that uses tweets or IRC chats. Do you just mean something that can fetch tweets and read them, or fetch IRC chat and read it? Thanks again for your help!
Was This Post Helpful? 0
  • +
  • -

#5 jhouns  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 100
  • Joined: 21-December 09

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:20 PM

From the sounds of it that's exactly what he meant. Alternatively I've been looking around and found something that may interest you:
http://www.codeproje...using-GSM-Modem
Was This Post Helpful? 1
  • +
  • -

#6 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:27 PM

Thanks for the reply jhouns! As it turns out, I just found that same site less than five minutes ago and have been reading it. So far it looks like it very well may do just what I am looking for!
Was This Post Helpful? 0
  • +
  • -

#7 jhouns  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 100
  • Joined: 21-December 09

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:31 PM

Great, and if it doesn't work out you have a whole host of ideas further up to explore. Good luck.
Was This Post Helpful? 0
  • +
  • -

#8 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:38 PM

One last note, I found a mention somewhere of this service called Twilio that seems to allow the sort of thing I am trying to do. I am not sure whether or not it will work for what I am doing, but it is just something else I am looking into.
Was This Post Helpful? 0
  • +
  • -

#9 jhouns  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 25
  • View blog
  • Posts: 100
  • Joined: 21-December 09

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 02:47 PM

When you send/receive messages you typically need to use a gateway, twillio is a gateway with an API to let you use it easily, trouble is it costs.
Was This Post Helpful? 0
  • +
  • -

#10 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 03:37 PM

Well I suppose maybe that would be an option if one needed a more robust solution to handle a lot of traffic. For now I will start by trying to just use that post you suggested. Thanks for the help!
Was This Post Helpful? 0
  • +
  • -

#11 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3652
  • View blog
  • Posts: 11,421
  • Joined: 05-May 12

Re: Controlling a C# application with SMS messages

Posted 29 November 2013 - 04:30 PM

View Postms4sman, on 29 November 2013 - 04:12 PM, said:

So Skydiver, let me see if I understand what you mean here. Your suggestion is to simply use an Android phone hooked to a computer to receive the message, then transfer it through a USB cable to the computer, and then the C# application will read the data coming in on the USB? If I understand that right, it sounds about like what I am looking for. However, I have to wonder how you could scale that up if the need arises to handle a lot of traffic. Perhaps that is where you would bring in something like a GSM Modem.

My gut feel is that you'll be at hundreds of messages per minute before you get to the point that the overhead of using the 'Droid to get your incoming messages becomes so much that you'll want to switch over to getting the data without the overhead of the Android OS.

View Postms4sman, on 29 November 2013 - 04:12 PM, said:

I will have to do some more research on this, but I have one more question for you Skydiver. I don't think I understood what you mean by a C# program that uses tweets or IRC chats. Do you just mean something that can fetch tweets and read them, or fetch IRC chat and read it?

Yes. This lets you exercise the your code which will get notifications of getting an incoming message, and doing something with it.
Was This Post Helpful? 0
  • +
  • -

#12 click_here  Icon User is offline

  • D.I.C Head

Reputation: 33
  • View blog
  • Posts: 187
  • Joined: 25-November 13

Re: Controlling a C# application with SMS messages

Posted 30 November 2013 - 05:43 AM

I have used this device before: https://www.sparkfun.com/products/9427

You can control the device using AT commands via RS232 (a USB to RS232 converter will do the trick with the serial object)
Was This Post Helpful? 0
  • +
  • -

#13 ms4sman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 31-July 13

Re: Controlling a C# application with SMS messages

Posted 06 December 2013 - 01:21 PM

Thanks for the replies guys! It looks like have some good information to research now!
Was This Post Helpful? 0
  • +
  • -

#14 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4559
  • View blog
  • Posts: 7,980
  • Joined: 08-June 10

Re: Controlling a C# application with SMS messages

Posted 06 December 2013 - 01:49 PM

Let me just suggest some things from a security standpoint.

Cell phones or GSM modems, either way you're going to have an open phone number sitting out there. Anyone could theoretically send signals to your applications. If this application is going to be doing anything sensitive or important, you might consider embedding authentication information in your messages (which will make it much less simple, since you aren't likely to hand-type an encrypted message, you'd probably need to write a mobile app). Or you can make your application only honor commands from pre-determined phone numbers (your own and whoever else you want to control your app). However, ANI can be spoofed or hidden, so you really can't rely on that as true security.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1