简体   繁体   English

c ++发布中使用的udp端口

[英]c++ Release udp port which is in use

I am currently working on an add-on for a dedicated server of halo, however the server tends to crash every now and then and the port stays in use. 我目前正在为光环专用服务器开发附加组件,但是该服务器往往会不时崩溃,并且端口仍在使用中。

So when the program is restarted after a crash it doesn't transmit any information internally (localhost) or over the internet. 因此,当程序崩溃后重新启动时,它不会在内部(本地主机)或互联网上传输任何信息。

What we could do is add a function to our addon that automatically Releases/makes the port available at the start of the program and then let the program initialize it self again so it works fine. 我们可以做的是在插件中添加一个功能,该功能可以在程序启动时自动释放/使端口可用,然后让程序再次对其进行自我初始化,以使其正常运行。

However we have no knowledge about udp or network programming in c++ at this moment, so we are basically asking if someone knows if this is possible(or some other way of fixing this problem) and how to make this in c++ for windows. 但是,目前我们还不了解C ++中的udp或网络编程,因此我们基本上是在询问是否有人知道这是否可行(或其他解决此问题的方法)以及如何在Windows的C ++中做到这一点。

We already googled some but couldn't find anything useful. 我们已经用谷歌搜索了一些,但是找不到有用的东西。

程序应使用套接字选项SO_REUSEADDR,这将允许在程序重新启动后使用套接字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM