You are not logged in.

#1 2016-06-26 06:37:33

conn-fused
Member
Registered: 2011-06-19
Posts: 28

Netstat not showing all Deluge peers

Hi all,

I recently ran "netstat -pntu" while also running deluge. To my surprise, not all of the peers shown by deluge were shown by netstat. Results were the same with "ss -pntu".

Does anyone have any idea why this might be?

Thanks.

Offline

#2 2016-06-26 21:46:44

mpan
Member
Registered: 2012-08-01
Posts: 1,207
Website

Re: Netstat not showing all Deluge peers

“Peers” are application-layer concept of the BitTorrent protocol. netstat works on transport layer. It has no idea about peers, it can only show information about connections and the state of the sockets on the machine.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2016-06-26 23:32:36

conn-fused
Member
Registered: 2011-06-19
Posts: 28

Re: Netstat not showing all Deluge peers

OK, but if data is being transferred between my machine and another, how can that happen without a connection that is observable by netstat? Or perhaps more to the point, why should some active peers have associated connections while others do not?

Thanks again.

Last edited by conn-fused (2016-06-26 23:33:24)

Offline

#4 2016-06-27 03:06:31

mpan
Member
Registered: 2012-08-01
Posts: 1,207
Website

Re: Netstat not showing all Deluge peers

Some of them may use UDP, which is connectionless by itself.


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#5 2016-06-27 03:20:13

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Netstat not showing all Deluge peers

@mpan, the -u switch of netstat does show active UDP connections, AFAIK.

@conn-fused, are you sure that the peers not being shown in netstat's output are actually active? Perhaps they were active some time ago and the torrent client is caching that information?

Offline

#6 2016-06-27 06:33:00

mpan
Member
Registered: 2012-08-01
Posts: 1,207
Website

Re: Netstat not showing all Deluge peers

x33a wrote:

@mpan, the -u switch of netstat does show active UDP connections, AFAIK.

No, the -u switch shows UDP sockets. There is no way netstat could show UDP connection, because there is no such thing as “UDP connections”.

Actually netstat doesn’t show connections at all, even for TCP. It only lists sockets. Since TCP sockets may have remote address associated with them, it shows these address as the part of the data it has on a given socket. This, in turn, can be interpreted as a connection. But netstat itself doesn’t even care about it — it just prints info associated with a local socket.

--edit

To be even more precise, netstat doesn’t know even about the remote side of a TCP connection. What “Foreign address” column shows is really a locally set address filter for incoming packets and the default source address to be used by send. Again, as it happens, for TCP sockets created by accept this is the same as the address of the foreign side of the connection. This filtering/default address may also be set for UDP sockets — but this will not create any connections (merely few bytes in the local memory are changed). The feature is rarely used too, because it would require multiple UDP sockets to be created for a typical application (with no obvious benefits): normally a single UDP socket is created, what can be seen for example in Deluge:

$ sudo netstat -panu | grep -F "$(pgrep deluge)/"
udp        0      0 0.0.0.0:45414           0.0.0.0:*                           622/python2         
udp6       0      0 :::45414                :::*                                622/python2 

The listed UDP sockets handle all peers at the same time. There is no need to waste resources on creating more.

Last edited by mpan (2016-06-27 07:24:53)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#7 2016-06-27 07:30:19

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Netstat not showing all Deluge peers

@mpan, thanks, that's very informative.

Offline

#8 2016-06-30 11:27:56

conn-fused
Member
Registered: 2011-06-19
Posts: 28

Re: Netstat not showing all Deluge peers

@x33a: Yes, the connections were active. I considered the possibility of stale information from deluge, so I tested repeatedly against connections that showed considerable, persistent flow of data.

The explanation from mpan seems to be a good one (thanks, mpan) and puts the core question to rest. There is one logical follow-on though: what tool would do what I wanted to do? That is, what can I use to see which addresses my system is currently exchanging data with? 

Thanks.

Offline

#9 2016-06-30 12:04:12

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Netstat not showing all Deluge peers

You might find some hints in this thread: http://askubuntu.com/questions/257263/h … n-terminal

Offline

Board footer

Powered by FluxBB