肝火郁结是什么症状| 肾结石不能吃什么东西| 吃金蝉有什么好处| 洋酒兑什么饮料好喝| 小孩吃什么水果好| 邪犯少阳证是什么意思| 为什么指甲会凹凸不平| 虫见读什么| 牛油果什么味道| gree是什么牌子| 有什么好| 肝区回声密集是什么意思| 痛风能吃什么东西| 冲锋衣是什么意思| 姓袁女孩叫什么名字好听| 环比是什么意思| 有容乃大什么意思| 脚趾第二个比第一个长有什么说法| 办身份证的地方叫什么| 爬灰什么意思| 啤酒ipa是什么意思| 飞刀是什么意思| 孕晚期缺铁对胎儿有什么影响| 执念什么意思| 宿便是什么颜色| 血小板高是什么问题| 感冒吃什么饭菜比较好| 梦见打老婆是什么预兆| 西米露是什么材料做的| 副歌部分是什么意思| instagram是什么意思| 软组织损伤是什么意思| 血管变窄吃什么能改善| 小孩吃火龙果有什么好处| 坚壁清野什么意思| 5月29日什么星座| 阿尔茨海默病吃什么药| 提莫是什么意思| 吃什么长头发又密又多| 流产可以吃什么水果| 业报是什么意思| 碱性磷酸酶高是什么原因| 感冒虚弱吃什么食物好| 弱阳性是什么原因| 精子不液化吃什么药| 什么是心衰| 宝贝是什么意思| 黄褐斑内调吃什么中药| 经常口腔溃疡挂什么科| 早期复极是什么意思| 用黄瓜敷脸有什么功效| 颈椎病用什么药膏| 尿出来很黄是什么原因| 略什么意思| 炒米是什么米做的| 排卵试纸两条杠是什么意思| dm是什么单位| 新生儿足底采血检查什么项目| abc是什么药| 什么是溺水| 叶黄素对眼睛有什么功效| 脚趾缝脱皮是什么原因| 不甚感激是什么意思| 磨豆浆是什么意思| 黑洞是什么意思| 怀孕第一天有什么症状| 卧底是什么意思| lily是什么牌子| 支那是什么意思| 余田是什么字| 为什么会早泄| 钢琴8级什么水平| 慢性浅表性胃炎是什么意思| 1什么意思| 册封是什么意思| 丁克是什么药| 吃什么水果对眼睛好| 属牛男和什么属相最配| 7月1号什么星座| 出现血尿是什么原因| style什么意思| 淋病吃什么药好的最快| 72年五行属什么| 实时播报什么意思| 鼻子经常出血是什么原因| 过期牛奶有什么用途| 公共关系是什么意思| 贫血的人吃什么水果| 什么是副乳| 优生四项是检查什么| 图灵是什么意思| 什么是脂溢性脱发| 胰腺炎是什么病严重吗| 生殖科检查什么| 腺肌症吃什么药效果好| 坚果什么时候吃最好| 什么是宦官| 1989年五行属什么| 痔疮的初期症状是什么| 什么是棱长| 气血两虚吃什么补最快| 中暑了吃什么药| 针眼用什么眼药水| 高血压用什么药| 今天什么日子| 血红素高是什么原因| 什么是扁平足图片| 阿尔茨海默病吃什么药| 什么河水| paw是什么意思| 凤凰是什么生肖| 家里适合养什么鱼| 孕晚期破水是什么症状| 淀粉酶测定是查什么| 伤口流水是什么原因| 面部脂溢性皮炎用什么药| 为什么青霉素要做皮试| 三险一金是什么| 表妹是什么关系| 真我是什么意思| 吃避孕药有什么好处| 羊蝎子是什么东西| 沉默不是代表我的错是什么歌| 阑尾炎可以吃什么水果| 飞机杯什么意思| 低烧吃什么药最好| 挫败感是什么意思| 梦见好多肉是什么意思| 如意丹的作用是什么| 十点多是什么时辰| 女性什么时候最容易怀孕| 脂肪肝吃什么水果好| 什么移动卡流量多| zuczug是什么牌子| 相敬如宾什么意思| 梦见自己拉了很多屎是什么意思| 一个口一个我念什么| 弱碱水是什么水| 钙片不能和什么一起吃| 心悸症状是什么感觉| 燕窝有什么营养价值| 什么来钱快| 咳嗽看什么科室| 为什么不建议做冠脉cta检查| 女人总犯困是什么原因| 垮掉是什么意思| 男生早上为什么会晨勃| 若干是什么意思| 绝经三年了突然又出血了什么原因| 头经常晕是什么原因| 骨质硬化是什么意思| 眷属是什么意思| 美国绿卡有什么好处| 血管堵塞用什么药| 兔头是什么意思| 妈妈生日送什么| 梦见在水里游泳是什么意思| 丧尸是什么意思| 什么生| 铁树开花是什么生肖| 肚子疼拉肚子吃什么药| 精神洁癖是什么意思| 银杏果什么时候成熟| 面包用什么面粉| 口腔痛什么原因| 胸口疼是什么病的前兆| 脖子上长小肉粒是什么| gr什么意思| 脚底烧热是什么原因| 头上出汗多是什么原因| 失眠多梦用什么药| 职业年金有什么用| 女人梦见龙是什么征兆| 吃什么会长高| 银屑病是什么病| 手热脚凉是什么原因| 于无声处是什么意思| 为什么蚊子总是咬我| 夫复何求什么意思| 8月17号是什么星座| 萎缩性胃炎可以吃什么水果| 能吃是福是什么意思| 皮角是什么病| 属虎的本命佛是什么佛| 脑梗需要注意什么| 矫枉过正什么意思| 哈衣是什么意思| 小腿抽筋是什么原因| 权威是什么意思| 婚检是什么意思| 啤酒兑什么饮料好喝| 喜欢紫色的人是什么性格| 咖啡什么时候喝最好| 大姨夫是什么| 生肖排第六是什么生肖| 38是什么意思| 松针是什么| mlb是什么品牌| 婴儿蚊虫叮咬红肿用什么药| 梦见穿裤子是什么意思| 头孢是治疗什么的| 2013年是什么年| 并发症是什么意思| 6月30日是什么节日| 什么是华盖| 夫妻合葬有什么讲究| 烧心吃什么| 夫妻相是什么意思| 血糖高什么水果不能吃| 脊柱侧弯有什么症状| 家里出现蟑螂预示什么| im是什么| 化合物是什么| 什么是酸性食物| jimmychoo是什么牌子| 梦见死去的姥姥是什么意思| 2月21日什么星座| 吃豆角中毒什么症状| balenciaga什么品牌| 双什么意思| 左侧小腹疼是什么原因| 见色起意是什么意思| 便秘挂什么科室| 神经递质是什么意思| 犹太是什么意思| 备孕吃什么药| 奇门遁甲是什么意思| 水云间什么意思| 左边脖子疼是什么原因| 生育险是什么| 闷是什么意思| 上午十点是什么时辰| 什么不能带上飞机| 瘦的人吃什么才能变胖| 什么不安成语| 为什么会结石| 叉烧是什么| 腹泻能吃什么水果| 梦见菊花是什么意思啊| pr医学上什么意思| 什么样人穿棉麻好看| 梦到生孩子是什么意思| 什么是飞机杯| 梦见奶奶去世预示什么| 什么人没有国籍| 体脂是什么| 草果是什么| 两个山念什么| 广东省省长是什么级别| ac是什么元素| 肝左叶囊性灶什么意思| 小孩肚子疼是什么原因| 七月二十是什么星座| 脚烧热是什么原因| 隐翅虫吃什么| 椎体楔形变是什么意思| 飞蛾吃什么| 女大四岁有什么说法| 为什么一睡觉就做梦| 运动后恶心想吐是什么原因| 核桃不能和什么一起吃| 脾虚吃什么好| 啃手指甲是什么毛病| 喧宾夺主什么意思| 百度Jump to content

男教师疑妻出轨打断妻子肋骨 被叛一年六个月

From Wikipedia, the free encyclopedia
百度 评测结果:如图可见,静置5分钟后高保湿霜周围仅有一小圈颜色变深,证明高保湿霜的质地均匀,含油量少,能适度滋润肌肤,但不油腻。

A network socket is a software structure within a network node of a computer network that serves as an endpoint for sending and receiving data across the network. The structure and properties of a socket are defined by an application programming interface (API) for the networking architecture. Sockets are created only during the lifetime of a process of an application running in the node.

Because of the standardization of the TCP/IP protocols in the development of the Internet, the term network socket is most commonly used in the context of the Internet protocol suite, and is therefore often also referred to as Internet socket. In this context, a socket is externally identified to other hosts by its socket address, which is the triad of transport protocol, IP address, and port number.

The term socket is also used for the software endpoint of node-internal inter-process communication (IPC), which often uses the same API as a network socket.

Use

[edit]

The use of the term socket in software is analogous to the function of an electrical female connector, a device in hardware for communication between nodes interconnected with an electrical cable. Similarly, the term port is used for external physical endpoints at a node or device.

The application programming interface (API) for the network protocol stack creates a handle for each socket created by an application, commonly referred to as a socket descriptor. In Unix-like operating systems, this descriptor is a type of file descriptor. It is stored by the application process for use with every read and write operation on the communication channel.

At the time of creation with the API, a network socket is bound to the combination of a type of network protocol to be used for transmissions, a network address of the host, and a port number. Ports are numbered resources that represent another type of software structure of the node. They are used as service types, and, once created by a process, serve as an externally (from the network) addressable location component, so that other hosts may establish connections.

Network sockets may be dedicated for persistent connections for communication between two nodes, or they may participate in connectionless and multicast communications.

In practice, due to the proliferation of the TCP/IP protocols in use on the Internet, the term network socket usually refers to use with the Internet Protocol (IP). It is therefore often also called Internet socket.

Socket addresses

[edit]

An application can communicate with a remote process by exchanging data with TCP/IP by knowing the combination of protocol type, IP address, and port number. This combination is often known as a socket address. It is the network-facing access handle to the network socket. The remote process establishes a network socket in its own instance of the protocol stack and uses the networking API to connect to the application, presenting its own socket address for use by the application.

Implementation

[edit]

A protocol stack, usually provided by the operating system (rather than as a separate library, for instance), is a set of services that allows processes to communicate over a network using the protocols that the stack implements. The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data.

The application programming interface (API) that programs use to communicate with the protocol stack, using network sockets, is called a socket API. Development of application programs that utilize this API is called socket programming or network programming. Internet socket APIs are usually based on the Berkeley sockets standard. In the Berkeley sockets standard, sockets are a form of file descriptor, due to the Unix philosophy that "everything is a file", and the analogies between sockets and files. Both have functions to read, write, open, and close. In practice, the differences strain the analogy, and different interfaces (send and receive) are used on a socket. In inter-process communication, each end generally has its own socket.

In the standard Internet protocols TCP and UDP, a socket address is the combination of an IP address and a port number, much like one end of a telephone connection is the combination of a phone number and a particular extension. Sockets need not have a source address, for example, for only sending data, but if a program binds a socket to a source address, the socket can be used to receive data sent to that address. Based on this address, Internet sockets deliver incoming data packets to the appropriate application process.

Socket often refers specifically to an internet socket or TCP socket. An internet socket is minimally characterized by the following:

  • local socket address, consisting of the local IP address and (for TCP and UDP, but not IP) a port number
  • protocol: A transport protocol, e.g., TCP, UDP, raw IP. This means that (local or remote) endpoints with TCP port 53 and UDP port 53 are distinct sockets, while IP does not have ports.
  • A socket that has been connected to another socket, e.g., during the establishment of a TCP connection, also has a remote socket address.

Definition

[edit]

The distinctions between a socket (internal representation), socket descriptor (abstract identifier), and socket address (public address) are subtle, and these are not always distinguished in everyday usage. Further, specific definitions of a socket differ between authors. In IETF Request for Comments, Internet Standards, in many textbooks, as well as in this article, the term socket refers to an entity that is uniquely identified by the socket number. In other textbooks,[1] the term socket refers to a local socket address, i.e. a "combination of an IP address and a port number". In the original definition of socket given in RFC 147,[2] as it was related to the ARPA network in 1971, "the socket is specified as a 32-bit number with even sockets identifying receiving sockets and odd sockets identifying sending sockets." Today, however, socket communications are bidirectional.

Within the operating system and the application that created a socket, a socket is referred to by a unique integer value called a socket descriptor.

Tools

[edit]

On Unix-like operating systems and Microsoft Windows, the command-line tools netstat or ss[3] are used to list established sockets and related information.

Example

[edit]

This example, modeled according to the Berkeley socket interface, sends the string "Hello, world!" via TCP to port 80 of the host with address 203.0.113.0. It illustrates the creation of a socket (getSocket), connecting it to the remote host, sending the string, and finally closing the socket:

Socket mysocket = getSocket(type = "TCP")
connect(mysocket, address = "203.0.113.0", port = "80")
send(mysocket, "Hello, world!")
close(mysocket)

Types

[edit]

Several types of Internet socket are available:

Datagram sockets
Connectionless sockets, which use User Datagram Protocol (UDP).[4] Each packet sent or received on a datagram socket is individually addressed and routed. Order and reliability are not guaranteed with datagram sockets, so multiple packets sent from one machine or process to another may arrive in any order or might not arrive at all. Special configuration may be required to send broadcasts on a datagram socket.[5] In order to receive broadcast packets, a datagram socket should not be bound to a specific address, though in some implementations, broadcast packets may also be received when a datagram socket is bound to a specific address.[6]
Stream sockets
Connection-oriented sockets, which use Transmission Control Protocol (TCP), Stream Control Transmission Protocol (SCTP) or Datagram Congestion Control Protocol (DCCP). A stream socket provides a sequenced and unique flow of error-free data without record boundaries, with well-defined mechanisms for creating and destroying connections and reporting errors. A stream socket transmits data reliably, in order, and with out-of-band capabilities. On the Internet, stream sockets are typically implemented using TCP so that applications can run across any networks using TCP/IP protocol.
Raw sockets
Allow direct sending and receiving of IP packets without any protocol-specific transport layer formatting. With other types of sockets, the payload is automatically encapsulated according to the chosen transport layer protocol (e.g. TCP, UDP), and the socket user is unaware of the existence of protocol headers that are broadcast with the payload. When reading from a raw socket, the headers are usually included. When transmitting packets from a raw socket, the automatic addition of a header is optional.
Most socket application programming interfaces (APIs), for example, those based on Berkeley sockets, support raw sockets. Windows XP was released in 2001 with raw socket support implemented in the Winsock interface, but three years later, Microsoft limited Winsock's raw socket support because of security concerns.[7]
Raw sockets are used in security-related applications like Nmap. One use case for raw sockets is the implementation of new transport-layer protocols in user space.[8] Raw sockets are typically available in network equipment, and used for routing protocols such as the Internet Group Management Protocol (IGMP) and Open Shortest Path First (OSPF), and in the Internet Control Message Protocol (ICMP) used, among other things, by the ping utility.[9]

Other socket types are implemented over other transport protocols, such as Systems Network Architecture[10] and Unix domain sockets for internal inter-process communication.

Socket states in the client-server model

[edit]

Computer processes that provide application services are referred to as servers, and create sockets on startup that are in the listening state. These sockets are waiting for initiatives from client programs.

A TCP server may serve several clients concurrently by creating a unique dedicated socket for each client connection in a new child process or processing thread for each client. These are in the established state when a socket-to-socket virtual connection or virtual circuit (VC), also known as a TCP session, is established with the remote socket, providing a duplex byte stream.

A server may create several concurrently established TCP sockets with the same local port number and local IP address, each mapped to its own server-child process, serving its own client process. They are treated as different sockets by the operating system since the remote socket address (the client IP address or port number) is different; i.e. since they have different socket pair tuples.

UDP sockets do not have an established state, because the protocol is connectionless. A UDP server process handles incoming datagrams from all remote clients sequentially through the same socket. UDP sockets are not identified by the remote address, but only by the local address, although each message has an associated remote address that can be retrieved from each datagram with the networking application programming interface (API).

Socket pairs

[edit]

Local and remote sockets communicating over TCP are called socket pairs. Each socket pair is described by a unique 4-tuple consisting of source and destination IP addresses and port numbers, i.e. of local and remote socket addresses.[11][12] As discussed above, in the TCP case, a socket pair is associated on each end of the connection with a unique 4-tuple.

History

[edit]

The term socket dates to the publication of RFC 147 in 1971, when it was used in the ARPANET. Most modern implementations of sockets are based on Berkeley sockets (1983), and other stacks such as Winsock (1991). The Berkeley sockets API in the Berkeley Software Distribution (BSD), originated with the 4.2BSD Unix operating system as an API. Only in 1989, however, could UC Berkeley release versions of its operating system and networking library free from the licensing constraints of AT&T's copyright-protected Unix.

In c. 1987, AT&T introduced the STREAMS-based Transport Layer Interface (TLI) in UNIX System V Release 3 (SVR3).[13] and continued into Release 4 (SVR4).[14]

Other early implementations were written for TOPS-20,[15] MVS,[15] VM,[15] IBM-DOS (PCIP).[15][16]

Sockets in network equipment

[edit]

The socket is primarily a concept used in the transport layer of the Internet protocol suite or session layer of the OSI model. Networking equipment such as routers, which operate at the internet layer, and switches, which operate at the link layer, do not require implementations of the transport layer. However, stateful network firewalls, network address translators, and proxy servers keep track of active socket pairs. In multilayer switches and quality of service (QoS) support in routers, packet flows may be identified by extracting information about the socket pairs.

Raw sockets are typically available in network equipment and are used for routing protocols such as IGRP and OSPF, and for Internet Control Message Protocol (ICMP).

See also

[edit]

References

[edit]
  1. ^ Cisco Networking Academy Program, CCNA 1 and 2 Companion Guide Revised Third Edition, P.480, ISBN 1-58713-150-1
  2. ^ RFC 147
  3. ^ Jack Wallen (2025-08-07). "An Introduction to the ss Command".
  4. ^ V. S. Bagad, I. A. Dhotre (2008), Computer Networks (5th revised edition, 2010 ed.), Technical Publications Pune, p. 52
  5. ^ SO_BROADCAST, Microsoft, retrieved 2025-08-07
  6. ^ Class DatagramSocket, Oracle, retrieved 2025-08-07
  7. ^ Ian Griffiths for IanG on Tap. 12 August 2004. Raw Sockets Gone in XP SP2
  8. ^ "raw(7): IPv4 raw sockets - Linux man page". die.net.
  9. ^ "Raw IP Networking FAQ". faqs.org.
  10. ^ "www-306.ibm.com - AnyNet Guide to Sockets over SNA". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  11. ^ books.google.com - UNIX Network Programming: The sockets networking API
  12. ^ books.google.com - Designing BSD Rootkits: An Introduction to Kernel Hacking
  13. ^ (Goodheart 1994, p. 11)
  14. ^ (Goodheart 1994, p. 17)
  15. ^ a b c d "historyofcomputercommunications.info - Book: 9.8 TCP/IP and XNS 1981 - 1983". Archived from the original on 2025-08-07. Retrieved 2025-08-07.
  16. ^ The Desktop Computer as a Network Participant.pdf 1985

Further reading

[edit]
  • Jones, Anthony; Ohlund, Jim (2002). Network Programming for Microsoft Windows. Microsoft Press. ISBN 0-7356-1579-9.
[edit]
吃什么能降血压 小孩吃什么通便降火 口炎读什么 天秤座后面是什么星座 尿酸高不能吃什么东西
甲状腺挂什么科 溜号是什么意思 子宫囊肿严重吗有什么危害 转氨酶高吃什么药最好 厦门为什么叫厦门
来大姨妈喝红糖水有什么作用 什么叫托特包 中秋节干什么 c1和c2有什么区别 11.19是什么星座
血压高是什么引起的 左心室肥大是什么意思 吃什么容易消化 eicu是什么意思 云是什么生肖
什么是支原体感染hcv8jop6ns9r.cn 五月十三日是什么星座hcv8jop5ns0r.cn 不踏实是什么意思hcv8jop1ns8r.cn 狗狗肠胃不好吃什么药最好hcv8jop3ns2r.cn 鱼腥草破壁饮片有什么功效onlinewuye.com
再三的意思是什么hcv9jop0ns2r.cn 为什么会有眼袋hcv9jop4ns3r.cn 走肾不走心什么意思jinxinzhichuang.com 十年结婚是什么婚hcv9jop0ns4r.cn 26年属什么生肖hcv8jop8ns2r.cn
什么宠物好养又干净hcv8jop7ns5r.cn 手上长斑点是什么原因hcv8jop8ns1r.cn 传媒公司主要做什么hcv9jop6ns2r.cn 百合与什么搭配最好hcv8jop4ns2r.cn 强的松又叫什么名字huizhijixie.com
疯狂动物城里的狐狸叫什么hcv9jop4ns3r.cn 耳鸣是什么病的前兆hcv7jop6ns6r.cn 公安局跟派出所有什么区别hcv8jop8ns1r.cn 症结是什么意思hcv7jop7ns2r.cn 千千阙歌是什么意思hcv8jop5ns6r.cn
百度