Home  >  Article  >  Operation and Maintenance  >  What is linux s type file

What is linux s type file

青灯夜游
青灯夜游Original
2022-03-21 15:40:427255browse

In Linux, the s type file refers to the "socket file (socket)", which is a special file used for communication between processes; a network can be initialized through this file protocol, and then you can use a series of functions to initialize, transmit, etc. the network protocol.

What is linux s type file

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Linux file types (b, c, d, l, s, -)

##File TypeDescriptionbBlock devices are interface devices that provide system access to data, such as hard disks. cCharacter devices are interface devices for some serial ports, such as keyboards, mice, printers, and tty terminals. d Directory, similar to Windows folders. lsSocket file (socket), used for communication between processes. - Files are divided into plain text files (ASCII) and binary files (binary).
Link file, similar to Windows shortcut.

Socket socket is a special file. You can initialize a network protocol through this socket, and then you can use it through a series of functions (write/read/ accept) to initialize, transmit, etc. this network protocol

socket definition

Socket is the middle software abstraction layer for communication between the application layer and the TCP/IP protocol family , which is a set of interfaces. In the design mode, Socket is actually a facade mode, which hides the complex TCP/IP protocol family behind the Socket interface. For users, a set of simple interfaces is all, allowing Socket to organize data to meet the specified requirements. Protocol

The structure of socket in the Linux kernel

The socket is actually a structure in the kernel. This structure contains members such as ip, port, state, size, etc. These members are used to initialize the detailed information of the socket, but we cannot use these members directly. Therefore, Linux provides corresponding interface functions for me to call. We use these functions to initialize the members in the socket structure

What is linux s type file

in the structure

  • ip, port: initialization IP address and port number

  • state: current network service status (monitoring/non-monitoring)

  • size: The maximum number of connections

Because we cannot directly operate these structure members, Linux provides corresponding interface functions for us to call and operate. These members

  • bind(): bind ip and port number

  • listen(): listen

  • .... etc. There are many other functions

Related recommendations: "

Linux Video Tutorial"

The above is the detailed content of What is linux s type file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn