Last active
December 22, 2015 03:09
-
-
Save caruizdiaz/6408393 to your computer and use it in GitHub Desktop.
sending a message using a random port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string number = "+595981146623"; | |
string text = "Hello World"; | |
int sendingPort = 0; | |
for(;;) | |
{ | |
Console.ReadLine(); | |
if (!Gateway.IsGwConnected) | |
{ | |
Console.WriteLine("GW is not connected. Please wait..."); | |
continue; | |
} | |
sendingPort = new Random().Next(0, 8); | |
if (!Gateway.IsPortReady(sendingPort)) | |
{ | |
Console.WriteLine("Port #{0} is not ready for sending sms through it. Check status.", sendingPort); | |
continue; | |
} | |
Console.WriteLine("Sending sms to {0}, using port {1}", number, sendingPort); | |
Gateway.SendMessage(number, text, sendingPort); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment