What is the difference between a port and a socket?

后端 未结 30 1938
旧巷少年郎
旧巷少年郎 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:07

    They are terms from two different domains: 'port' is a concept from TCP/IP networking, 'socket' is an API (programming) thing. A 'socket' is made (in code) by taking a port and a hostname or network adapter and combining them into a data structure that you can use to send or receive data.

提交回复
热议问题