Joke Collection Website - Blessing messages - Emergency C# AT instruction

Emergency C# AT instruction

Debugging under command must first support serial port operation, but. Net 1.x does not support serial port. However, there are many dedicated comrades on the website, and it is ok to borrow them. In fact, they are api calls.

[DllImport("kernel32.dll")]

Private static extern int createfile (); //Open the serial port

[DllImport("kernel32.dll")]

Private static external boolreadfile (); //Read serial port

[DllImport("kernel32.dll")]

Private static external boolwritefile (); //Write serial port

Packed into a. net serial port operation class. Of course, if the environment is above. Net 2.x, you can use System.IO.Ports.SerialPort, which has similar functions, except for read, which is write.

The first thing to understand is the port. In Device Manager, turn on the modem and it will tell you which port to use. Format: COMX(X= 1, 2,3,4 ...).

Then there are several concepts. One is the baud rate, that is, the maximum communication rate, which is low and high. The general modem is 56k, just fill in 57600. (This can also be found in Device Manager. )

The data bit is usually 8. Parity 0 stop bit 1. Of course, there are special circumstances, and the probability of encountering it is similar to winning the lottery. I really can't help it. Find a serial port monitoring tool, enter "Dialer" at the command line, open the dialer built in the window and dial once.

After the serial port is completed, you can move the modem. Let's try to contact first. (Note here that the at command ends with 0d, not characters, but 16 bytes. Just press Enter when entering, the same below. )

Input: AT

If the connection is correct, the modem will

Return: OK.

Next, dial the phone, write a set of strings, add the number you want to dial, if it is 10000, and then send it.

Input: ATDT 10000

The modem will dial 10000 and the phone will connect you. If you can't dial, the modem will return "No Dial Tone" or "Busy", read the return value, check these two things, and shoot again.

Take an extension cord and string it together. When the modem is connected, remind me to pick up the phone and talk to the other party.

Of course, a mobile phone is not as good as one person, and multiple lines are different. Open a few threads to dial and see who can be faster than me.