我应该在其他端口还是在同一端口上侦听? [英] Should I listen on different ports, or the same port?
问题描述
我正在编写一个C ++应用程序MyMasterApp(Windows和Mac),它正在侦听来自不同计算机和应用程序的大量信息. (通过UDP的OSC)
I'm writing a C++ application MyMasterApp (windows & mac) which is listening to a bunch of information coming from different computers and applications. (OSC via UDP)
即 MyMasterApp正在侦听来自多个Tracker应用程序的跟踪数据(这些跟踪器应用程序可能运行或可能不在同一台计算机上,但在同一有线网络上运行). 它还正在侦听来自其他许多应用程序的定向数据(在同一wifi上的移动设备上运行). 所有应用程序均以30Hz发送.
I.e. MyMasterApp is listening for Tracking data coming from a number of Tracker applications (which may or may not be running on the same computer, but on the same wired network). It's also listening to orientation data coming from a number of other applications (running on mobile devices, on the same wifi). All apps are sending at 30Hz.
所以:
/Tracker/Position1/[f] [f] [f]
/Tracker/Position1/[f] [f] [f]
/Tracker/Position2/[f] [f] [f]
/Tracker/Position2/[f] [f] [f]
/Tracker/Position3/[f] [f] [f]
/Tracker/Position3/[f] [f] [f]
/移动/方向1/[f] [f] [f] [f]
/Mobile/Orientation1/[f] [f] [f] [f]
/移动/方向2/[f] [f] [f] [f]
/Mobile/Orientation2/[f] [f] [f] [f]
/Mobile/Orientation3/[f] [f] [f] [f]
/Mobile/Orientation3/[f] [f] [f] [f]
我想知道是否存在以下差异(网络性能,冲突等)
I'm wondering whether there is any difference (in network performance, collisions etc) if:
MyMasterApp应该只侦听端口8000上的所有消息,并将所有Tracker应用程序和移动应用程序发送到端口8000
MyMasterApp should just listen to all messages on port 8000, and all Tracker apps, and Mobile apps send to port 8000
vs
MyMaster侦听端口8000上的Tracker消息,以及端口9000上的Mobile消息.
MyMaster listens to to Tracker messages on port 8000, and Mobile messages on port 9000.
两者似乎都可以正常工作,我只是想知道两者之间在性能上是否有优势,甚至关于使用哪一个的经验法则.有没有一个理论上的或记录的实践上的优势?还是差异可以忽略不计?
Both seem to work fine, I'm just wondering if there is any performance advantage of one over the other, or even a rule of thumb as to which one to use. re there any theoretical, or recorded practical advantages of one over the other? Or are the differences just negligible?