无法连接对等端口 - 无效端口设置? [英] Failed to connect peer - invalid port settings?

查看:249
本文介绍了无法连接对等端口 - 无效端口设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试初始化计算机上的两个应用程序以通过Windows对等组件进行通信时遇到了问题。这是我上一个问题的延续: Windows P2P Native API [ ^ ]并且可能实际上是相关的。我在链接问题中描述的问题是通过在注册到PNRP期间更改端口的默认值来解决:



Hi, I encountered a problem while trying to initialize two applications on my computer to communicate across the Windows peer-to-peer component. This is a continuation of my previous question: Windows P2P Native API[^] and might be actually related. The problem I describe in the linked question was "solved" by changing the default value of port during registration into PNRP:

PEER_PNRP_REGISTRATION_INFO regInfo;
ZeroMemory( ®Info, sizeof( PEER_PNRP_REGISTRATION_INFO ) );
regInfo.pwzCloudName = L"Global_";
regInfo.pwzComment = L"P2P Server";
regInfo.wPort = 2000;
regInfo.cAddresses = PEER_PNRP_AUTO_ADDRESSES;
HREGISTRATION reg;
if( SUCCEEDED( PeerPnrpRegister( peerName, ®Info, ® ) ) )
{
}





请注意regInfo.wPort = 2000; line - 如果我不这样做,那么对PeerGraphConnect的调用将失败,如前一个问题所述。但是,如果我填写一些端口号,图表连接首先成功,我可以订阅事件。但是,我收到的第一个事件是 PEER_GRAPH_EVENT_NEIGHBOR_CONNECTION ,连接状态设置为 PEER_CONNECTION_FAILED 。原因通常是 PEER_E_CONNECTION_FAILED ,除非我在原始对等注册中指定端口80。然后,失败的原因设置为 PEER_E_CONNECTION_NOT_AUTHENTICATED



MSDN页面 [ ^ ]对此错误不是很具体,但我猜这是一些常见的网络问题用我的代码。所以我的问题如下:

*为什么注册本身没有选择有效的端口?

*如何手动选择有效端口以便第二个应用程序是否能够联系已注册的同行?



感谢任何输入



note the "regInfo.wPort = 2000;" line - if I don''t do it, then the call to PeerGraphConnect fails as described in the former question. However, if I fill in some port number, the graph connection is at first successful and I am able to subscribe for events. However, the first event I receive is the PEER_GRAPH_EVENT_NEIGHBOR_CONNECTION with connection status set to PEER_CONNECTION_FAILED. Reason is usually PEER_E_CONNECTION_FAILED, unless I specify port 80 in the original peer registration. Then, the reason for failing is set to PEER_E_CONNECTION_NOT_AUTHENTICATED.

The MSDN page[^] is not very specific regarding this error, but I guess this is some general networking issue with my code. So my questions are as follows:
* Why does the registration not select a valid port by itself?
* And how do I select a valid port manually so that the second application is able to contact the registered peer?

Thanks for any input

推荐答案

请阅读kickstart您的知识: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers [ ^ ]
please read to kickstart your knowledge: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers[^]


这篇关于无法连接对等端口 - 无效端口设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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