Audiovox P965 Datasheet Page 260

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 259
API in C Sharp
257
Example 2
Block SMTP port and specific Ip rule by Oguzhan
using System.IO;
using System.Net.Sockets;
class Program
{
static void Main(string[] args)
{
string ip = args[0];
MK mikrotik = new MK("your ip here");
if (mikrotik.Login("admin", "P@ssW0rd"))
{
mikrotik.Send("/ip/firewall/filter/add");
mikrotik.Send("=action=drop");
mikrotik.Send("=chain=forward");
mikrotik.Send("=dst-port=25");
mikrotik.Send("=protocol=tcp");
mikrotik.Send("=protocol=tcp");
mikrotik.Send(String.Format("=src-address={0}",ip));
mikrotik.Send(".tag=firewall", true);
foreach (string h in mikrotik.Read())
{
Console.WriteLine(h);
}
}
}
}
Notes
I have not tested it thorougly (especialy length encoding with longer words)
You have to have using System.IO; and using System.Net.Sockets;
Exceptions are not handled
Page view 259
1 2 ... 255 256 257 258 259 260 261 262 263 264 265 ... 279 280

Comments to this Manuals

No comments