Discussion:
[libtorrent] Connecting peer manually
Ardhi Putra Pratama
2017-02-23 16:43:04 UTC
Permalink
Hello,

I'm now working on the emulation of the network using libtorrent. This
is done in cluster computer, so some instances of libtorrent in the
same computer, some are in different machine. We also don't have any
tracker or DHT whatsoever.

I already have the list of IP and listening port for each of the peer.
I tried to connect them using connect_peer(), but it seems can't work.
I also don't get any alert (peer_notification) whether it was
connected/disconnected. Because of this, the get_peer_info() is not
working either.

Do you have any suggestion? My goal is just to make sure all peers can
be seen (get_peer_info works flawlessly) from any other peers.

Thanks
Kind regards,

ardhi
--
Arvid Norberg
2017-03-03 00:34:49 UTC
Permalink
Post by Ardhi Putra Pratama
I'm now working on the emulation of the network using libtorrent. This
is done in cluster computer, so some instances of libtorrent in the
same computer, some are in different machine. We also don't have any
tracker or DHT whatsoever.
I already have the list of IP and listening port for each of the peer.
I tried to connect them using connect_peer(), but it seems can't work.
you can enable logging (in the alert_mask). It will tell you which
connections are attempted to be made under the hood. Logs are posted as
alerts.
Post by Ardhi Putra Pratama
I also don't get any alert (peer_notification) whether it was
connected/disconnected.
Failing to connect to a peer is so common, and not considered a severe
enough error to be posted in the error category of alerts. You have to
enable its category in the alert_mask to receive them.
Post by Ardhi Putra Pratama
Because of this, the get_peer_info() is not
working either.
when you say "is not working", do you mean it returns no peers? (if you in
fact fail to connect to peers, that seems like the correct response)
Post by Ardhi Putra Pratama
Do you have any suggestion? My goal is just to make sure all peers can
be seen (get_peer_info works flawlessly) from any other peers.
enable logging, including of which IP and port each session is listening on
and understand what's going on.

If you're trying to connect to multiple peers running on the same machine,
with the same IP address, you need to enable support for multiple peers on
the same IP. This is a bool setting in the settings_pack.
--
Arvid Norberg
Loading...