GMS Modem SMS Transceiver Module (C # version)

Source: Internet
Author: User
Tags connect requires wsdl

Test code: Http://www.cnblogs.com/Files/dyj057/Gms%20Modem SMS transceiver components. rar

There are many types of SMS deployment scenarios, and we now introduce 3 major deployment scenarios. Customers can choose one of these schemes to implement and complete the application of SMS.

Deployment of GMS Modem

Purchase hardware devices
The GMS Modem (Short message module) is a hardware device which communicates with the computer through a serial port to realize the sending of SMS. This hardware can be easily bought in the market, the price between 1000-2000 yuan. It is best to choose Siemens tc35i and MC35 as the core SMS module, we also provide SMS module hardware.

Buy a SIM card
In fact, the GMS modem is equivalent to a mobile phone and requires a SIM card to work. You can choose the type of charge that packs the local call fee, which can save a lot of money by sending text messages. For example: A card 50 yuan packet local call fee, even if you send 1 million messages a month, it also only cost 50 yuan. The cost of each message is very low.

Connection
Put the card into the GMS modem, and then use the module with the serial communication line and the serial port of the server connection, and then connect the power, program, set the serial number of GMs modem, and then start the SMS service, completed the entire deployment program.

Deployment of the SP platform
The deployment of the SP platform is complex and requires professional participation, which is not described in detail here.

SMS Web Service
SMS Web Service does not need to be deployed, just understand how it is used. such as Sina's SMS Send service:

Sina to send SMS Web service resources of the address is: http://smsinter.sina.com.cn/ws/ SMSWEBSERVICE0101.WSDL, which is a WSDL file format, you can add a Web reference directly to your vs.net environment and enter that address.

Please refer to the relevant instructions on the Sina Wireless website, it should be a two cents. Because the Message Queuing mechanism may be used in the background, there may be a few seconds of delay during busy times.

If it is used for a long time, the charge is a little expensive. You must also be connected to the Internet.

The following is a component that uses SMS modem to send SMS:

The main use of gmsmodemsvr this method to complete the message sent. These methods are:

Addmodem Add a modem to the server, if it has been added to the server, you can no longer add.
The Deletemodem modem workgroup removes a modem
Dispose frees unmanaged resources
Sendsms Send SMS, if the server has been started, start sending the thread, not directly into the send queue.
Start Run service, connect all modems
Stop stops service, cleans up system resources

Now let's illustrate:
1 Initialization device
Gmodemsvr svr = new Gmodemsvr ();

Initializes a modem connected from the serial port 1, using the baud rate of 57600 by default
If you have more than one modem, you can also add, system system to send SMS ability will multiply,
It supports the load balance between multiple modems and maximizes the utilization of system resources
Svr. Addmodem (New ibms.sms. Gmsmodem (1));

Receiving and processing method of registering new SMS
Svr. Onreceivedsms + = new recvedsms (form. ONRECVEDSMS);


Start running, send receive SMS Start
Svr. Start ();

2 Send SMS
Construct a new text message
Sendsms sms= New Sendsms ("8613500000000", "received a message to me back to one");

Send SMS, the back of the callback function is the new text message sent after the completion of the processing of the results
Svr. Sendsms (sms,new sendsmcallback) (form. Onsendsmend));

3 SMS Receive processing function
public void Onrecvedsms (object receiver, receivedsms receivedsms)
{
Console.WriteLine ("Recv ms ID" +receivedsms.id);

Console.WriteLine ("From:" +receivedsms.fromphonenumber);

Console.WriteLine ("Message:" + receivedsms.content);

}

Does not contain the source code for the class library, I'm sorry about that.
In the test source code contains the class library of the description of the document, do not understand where to see, you can email me.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.