Why does ONLY some connections have 'addrlocal' in getpeerinfo output I connected two laptops A and B to bitcoin testnet. I then manually connected B to A using addnode of bitcoin-client. 

Snippet of getpeerinfo from B:

  {
    "id": 1,
    "addr": "172.22.94.40:18333",
    "addrlocal": "137.122.81.217:53818",

  }
 { 
   "id": 10,
   "addr": "54.152.9.182:18333",
   "services": "000000000000000
 }


Some connection have an addrlocal set and its port 53818 is randomnly chosen. I searched through the codebase for this. It looks like some fInbound flag will be getting set in A. Can anyone in simple terms explain what is happening here? 

I know that a socket cannot be used for listening and sending data at the same time. Is it got to do with that? 

If 53818 is chosen as port to send data to A, then why is there no such random choice happening in seed node connection? (like 54.152.9.182 here in example)
I would guess addrlocal shows you your endpoint of the connection, that is your IP address and port number. For all incoming connections that would be the same as the IP address and port you are listening on, so that's why it's not displayed. In your case most likely: 137.122.81.217:8333

I'm not sure what would happen if the server is multihomed.