Skip to content

Instantly share code, notes, and snippets.

@caruizdiaz
Last active December 22, 2015 03:09
Show Gist options
  • Save caruizdiaz/6408393 to your computer and use it in GitHub Desktop.
Save caruizdiaz/6408393 to your computer and use it in GitHub Desktop.
sending a message using a random port
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