f you type "admin.nodeInfo" at the javascript console, you will see:

 listenAddr: "[::]:<value>",
  name: "Geth/v1.6.1-stable-021c3c28/linux-amd64/go1.8.1",
  ports: {
    discovery: <value>,
    listener: <value>

(along with a bunch of other stuff, of course.)

So we have these three ports: listenAddr, listener, discovery. What does each one of them mean in this context.

I am not asking about the RPC port or the websockets port. I am specifically asking about the thing that I just mentioned.

  • Are your discovery and listener ports the same? – 0xcaff Jun 9 '17 at 0:29
  • @0xcaff According to the readout above, yes. But this is essentially where my question is going. Once I learn what the differences are, I may be able to learn how to change them, and what purpose that might serve. – stone.212 Jun 9 '17 at 1:08
  • @stone212 did you ever get to the bottom of this? – significance Mar 23 '19 at 9:33
  • @significance No I don't think I did and I stopped using geth more than a year ago. But I learned a lot since May of 2017 so if you have a question that relates to this maybe I can answer? – stone.212 Mar 25 '19 at 10:41
  • @stone212 thanks for the offer! i think i did get to the bottom of it. it's super confusing because geth uses 30303/tcp for port comms and 30303/udp for kademlia discovery. i'll write it up below when i get a mo... – significance Mar 26 '19 at 11:37

There are basically three important ports. The first is discovery port, and other two are listener ports:

  1. Discovery port: (default is 30303). This port is used for connecting to other geth nodes.
  2. RPC port: (default is 8545). This port is used to send JSON-rpc requests to the geth client.
  3. Websocket port: (default is 8546) You can connect to geth client using websockets.

All of them are independent process and hence cannot be run on same ports.

  • 1
    Thank you for taking time to reply but this does not speak to my question at all. My question is what about the "listenAddr" and "listener" values that I find with "admin.nodeInfo" and how do they relate to the Discovery port? I've edited my post for more clarity. – stone.212 May 30 '17 at 18:17
  • ethereum.stackexchange.com/questions/809/… this could help you surely – pikachu May 31 '17 at 10:35
  • Akshay I appreciate the effort but that post mentions that there exist a listener and a discovery port. But from my OP you see that I knew that already. It does say that they can be the same, which is nice, although I wasn't really in doubt about that. – stone.212 May 31 '17 at 23:42

listenAddr is an address , i.e. contains IP+port number

listener is only a port number

discovery is also port number for finding new peers

The word listener has a meaning of a connecting gate, for example,this is another piece of ethereum's source ('node/node.go'):

    ipcListener net.Listener // IPC RPC listener socket to serve API requests
    httpListener  net.Listener // HTTP RPC listener socket to server API requests
    wsListener net.Listener // Websocket RPC listener socket to server API requests

In Go Listener is a standard type:

A Listener is a generic network listener for stream-oriented protocols.

Multiple goroutines may invoke methods on a Listener simultaneously.

    type Listener interface {
            // Accept waits for and returns the next connection to the listener.
            Accept() (Conn, error)

            // Close closes the listener.
            // Any blocked Accept operations will be unblocked and return errors.
            Close() error

            // Addr returns the listener's network address.
            Addr() Addr

This is the meaning of the word listener , but ListenAddr is the full address of the socket. it is defined in Linux kernel as this struct:

#include <netinet/in.h>

struct sockaddr_in {
    short            sin_family;   // e.g. AF_INET
    unsigned short   sin_port;     // e.g. htons(3490)
    struct in_addr   sin_addr;     // see struct in_addr, below
    char             sin_zero[8];  // zero this if you want to

The fields sin_addr and sin_port together is the variable listenAddr, in fact, this is what the method Addr() should return.

But in Ethereum code, by saying listener they don't refer to the Interface listener nor the object that implements listener interface, they refer to the port number.

  • Can you be a little more specific? Is "listener" ALWAYS the port number that goes into "listenAddr" or are they unrelated? And saying that something is an address or a port number does not explain what it is or how it is different from other addresses or port numbers. If you edit your answer to answer the question, I will mark it as the answer. – stone.212 Oct 7 '17 at 4:13
  • @stone212 I kind of tried to explain, check if you understand it – Nulik Oct 7 '17 at 6:29
  • I do not. The last paragraph is the first part that seems to relate to the question. The only parts that you mentioned that talk about the terms I ask, only repeat what you said earlier. Thank you for taking time but this is not in any remote way an answer to my question. – stone.212 Oct 7 '17 at 6:53
  • @stone212 it is, you just don't understand anything of what I just said. You should read about TCP/IP protocol and about network programming. Only then you will understand it. – Nulik Oct 7 '17 at 7:36
  • I think maybe you are confusing this with another answer you maybe wrote? This not related to networking, definitely not TCP/IP. The question was about the definition of “listen,” “listenaddr” and “discovery” as they relate to the output of "admin.nodeinfo" at the javascript console. It's okay. I sometimes think I am on a different thread also. – stone.212 Oct 7 '17 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.