static void Main(string[] args) { socket = IO.Socket("http://localhost:6000"); socket.On(Socket.EVENT_CONNECT, () => { Console.WriteLine("CONNECT - command"); SendMsgToServer("driver"); }); socket.On("start", (port) => { Console.WriteLine("start - command"); modem = new Modem((string)port); modem.GetCIMI(CallbackCIMI); }); socket.On("clean", (port) => { Console.WriteLine("clean - command"); modem.DelAllMessage(); }); socket.On("send-msg", (phone) => { Console.WriteLine("send-msg - command"); modem.SendMessage((string)phone, "Krivetka"); }); socket.On("check-msg", () => { Console.WriteLine("check-msg - command"); isControll = false; needCheck = true; while (needCheck) { modem.CheckMessage(CallbackMsg); System.Threading.Thread.Sleep(2000); } }); socket.On("check-number", () => { Console.WriteLine("check-number - command"); isControll = true; needCheck = true; while (needCheck) { modem.CheckMessage(CallbackMsg); System.Threading.Thread.Sleep(2000); } }); socket.On("stop", () => { Console.WriteLine("stop - command"); modem.Stop(); }); Console.ReadLine(); }
static void Main(string[] args) { string port = Console.ReadLine(); Modem modem = new Modem("COM" + port); modem.GetCIMI(); modem.CheckMessage(); modem.Stop(); Console.ReadLine(); }