窗口服务块应用程序或端口 [英] Window Service block application or port

查看:89
本文介绍了窗口服务块应用程序或端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我已经在参考文件中写了Window Service:简单Windows服务示例 [ ^ ]

现在,我要阻止窗口上的应用程序或端口,例如:阻止端口123,阻止程序notepad.exe.我认为它是在Service Onstart事件中写的.

Hello everybody.

I have write Window Service follow at reference : Simple Windows Service Sample[^]

Now , i want to block a application or port on window such as : Block Port 123, Block program notepad.exe . I think it`s write in Service Onstart event

Protected Overrides Sub OnStart(ByVal args() As String)

        'Block Port on Window
         'Block application on window , Example Block notepad.exe
    End Sub




您对这个主题有帮助吗,或者对我有参考链接.

谢谢.




Do you help me about this topic or reference link for me.

Thank you.

推荐答案

这就是您尝试编写的防火墙.除非您知道Windows网络堆栈,否则您将发现很难实现.

为了进行测试,您可以通过服务OnStart方法参数传递此信息.它的工作就像您写的一样.参数将作为数组中的几个字符串传递.

http://msdn.microsoft.com/en-us/library/system. serviceprocess.servicebase.onstart.aspx [ ^ ]

对于生产应用程序,防火墙配置通常存储在其他位置,例如注册表中的加密条目或配置文件.
This is called a firewall you''re attempting to write. Unless you know the Windows network stack, you''ll find this extremely difficult to implement.

For testing, you could pass this information in through the services OnStart method arguments. It works just like you wrote. The arguments would be passed in as a couple of strings in an array.

http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.onstart.aspx[^]

For a production application, a firewall config is usually stored somewhere else, like an encrypted entry in the Registry or a config file.


这篇关于窗口服务块应用程序或端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆