本文介绍了Linux C / C ++ udp socket端口问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我有一个udp数据包发送方有这个问题。
我希望端口用参数输入但是当我的代码设置时,端口设置为:
#define SERVICE_PORT 123 / * 123是此示例的端口* /
之前:
int main( int argc, char * argv [])
我有什么方法可以输入带有参数的端口并输入到代码并重新编译它?如果是这样,请告诉我如何。 :)
我的尝试:
i试图输入它与变量(将参数存储在veriable中)和自己的代码输入,但我没有那么成功。
解决方案
Hello, I have had this problem with a udp packet sender that i have.
I want the port to be inputed with arguments but as my code is set up the port is set with:
#define SERVICE_PORT 123 /*123 is the port for this example*/
before:
int main(int argc, char *argv[])
Is there eny way for me to input the port with arguments insted of going in to the sorce code and re-compile it? If so please tell me how. :)
What I have tried:
i have tried to input it with veriables (storing the argument in the veriable) and input from the code it self, but i have not been so succesfull.
解决方案
这篇关于Linux C / C ++ udp socket端口问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!