user675: I am looking for a cheap and efficient way (rather than hacking through the Bitcoin source code) of listing my peers.
Something I have come up with:
#!/bin/bash

netstat -p tcp -nba | grep  '.8333.*ESTABLISHED' | perl -npe 's/.*\s+((\d+.){3}\d+)\.\d+\s+ESTABLISHED.*/$1/'

The script above generates a list of IPs.

user2343: First, setup add the following to your bitcoin.conf to enable RPC (of course, you can use other values):
rpcuser=user 
rpcpassword=Pa55w0rd
rpcport=8333
server=1

After that, restart bitcoin and use following command to get IPs of all peers connected (you can probably make the parser part shorter by using perl instead of grep/sed):
USER=user
PASSWORD=Pa55w0rd
PORT=8333
curl --user $USER:$PASSWORD --data-binary \
'{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' \
-H 'content-type: text/plain;' http://127.0.0.1:$PORT/ 2>/dev/null \
| grep -o '"addr":"[^"]\+"' | cut -d":" -f2-3 | sed 's/^"//;s/"$//'


user208: Use the getpeerinfo RPC command (available since v0.7.0).

675: <p>I am looking for a cheap and efficient way (rather than hacking through the Bitcoin source code) of listing my peers.</p>

<p>Something I have come up with:</p>

<pre><code>#!/bin/bash

netstat -p tcp -nba | grep  '.8333.*ESTABLISHED' | perl -npe 's/.*\s+((\d+.){3}\d+)\.\d+\s+ESTABLISHED.*/$1/'
</code></pre>

<p>The script above generates a list of IPs.</p>
 2343: <p>First, setup add the following to your <code>bitcoin.conf</code> to enable RPC (of course, you can use other values):</p>

<pre><code>rpcuser=user 
rpcpassword=Pa55w0rd
rpcport=8333
server=1
</code></pre>

<p>After that, restart bitcoin and use following command to get IPs of all peers connected (you can probably make the parser part shorter by using perl instead of grep/sed):</p>

<pre><code>USER=user
PASSWORD=Pa55w0rd
PORT=8333
curl --user $USER:$PASSWORD --data-binary \
'{"jsonrpc": "1.0", "id":"curltest", "method": "getpeerinfo", "params": [] }' \
-H 'content-type: text/plain;' http://127.0.0.1:$PORT/ 2&gt;/dev/null \
| grep -o '"addr":"[^"]\+"' | cut -d":" -f2-3 | sed 's/^"//;s/"$//'
</code></pre>
 208: <p>Use the <code>getpeerinfo</code> RPC command (available since v0.7.0).</p>
