Score:0

Are socket numbers realted to source port numbers

de flag

I understand that socket=IP + port number but I was wondering if the internal number a socket has is related to the ephemeral port that is chosen for outgoing TCP connections?

For example this is from an lsof output of a volatility analysis of a memory dump from an Ubuntu 20.04 server:

0xffff982e732e8000 httpd 1272 61 socket:[28657]

0xffff982e732e8000 httpd 1272 62 socket:[28658]

Please ignore the fact that the process is called httpd.

Would 28657 and 28658 be used as source ports for those connections or are the numbers unrelated?

David avatar
cn flag
I do not see how this relates to Ubuntu but if you google understanding sockets you will find many articles you can read.
Michele avatar
de flag
I have googled that and all I find are tons of articles telling me a socket is IP address + port. Yes, I know that. That's not what I'm looking for. And I stated that I'm using Ubuntu as other OSs might handle it differently.
David avatar
cn flag
What version of Ubuntu.
uz flag
Jos
In a client-server-model connection, the server port is always a fixed number. The client may choose to use a fixed source port number, but this is unusual because the port number may already be in use. Therefore the client usually lets the OS decide which port number to use for the client process. That is usually a random port number (but guaranteed available).
uz flag
Jos
Fun fact: long ago, the OS would simply take the next available incremental port number. That has been the cause of many security leaks, as it is highly predictable, and therefore can be spoofed by a malicious server.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.