可以使用process 调用dos 命令打开需要打开的端口 netsh firewall add portopening udp(端口类型) 8081(端口号) myupdname(端口名称) 参考 http://support.microsoft.com/kb/875357