【发布时间】:2013-05-07 04:13:04
【问题描述】:
我正在 Linux 上使用 MonoDevelop 开发 Port Knocking 应用程序。 服务器应用程序使用 iptables 通过命令打开/关闭某些端口:
iptables -A INPUT -j DROP
它成功地应用了某些规则,例如:
iptables -A INPUT -p udp --dport 606:610 -j LOG
然后我用 UdpClient 创建了客户端应用程序来发送敲门请求
private static UdpClient udp;
public static void sendmessage (string message, string host, short port)
{
try
{
IPAddress ip=IPAddress.Parse(host);
if(udp==null)
udp=new UdpClient();
byte[] b=ASCIIEncoding.ASCII.GetBytes(message);
udp.Send(b,b.Length,new IPEndPoint(ip,port));
}
catch (Exception exc)
{
throw exc;
}
}
但是这个客户端应用程序崩溃了,似乎在服务器关闭每个端口时引发了异常。
有没有什么发送数据包的解决方案,不关心服务器是否关闭/打开某个端口?
【问题讨论】:
标签: c# monodevelop