What is the difference between a port and a socket?

后端 未结 30 2099
旧巷少年郎
旧巷少年郎 2020-11-22 14:31

This was a question raised by one of the software engineers in my organisation. I\'m interested in the broadest definition.

30条回答
  •  梦谈多话
    2020-11-22 15:08

    In a broad sense, Socket - is just that, a socket, just like your electrical, cable or telephone socket. A point where "requisite stuff" (power, signal, information) can go out and come in from. It hides a lot of detailed stuff, which is not required for the use of the "requisite stuff". In software parlance, it provides a generic way of defining a mechanism of communication between two entities (those entities could be anything - two applications, two physically separate devices, User & Kernel space within an OS, etc)

    A Port is an endpoint discriminator. It differentiates one endpoint from another. At networking level, it differentiates one application from another, so that the networking stack can pass on information to the appropriate application.

提交回复
热议问题