Linux Universal IO

Source: Internet
Author: User
Tags in domain

Open (), read (), write (), close () can be applied to all file types such as pipe, fifo,socket, or terminal to perform IO operations.

Lseek () does not apply to all types of files. Lseek () is not allowed to be applied to pipes, fifo,socket or terminals, and lseek can be applied to the device as long as it is reasonable. For example, find a specific location on a disk or tape.

CP Test Test.old

CP test/dev/pts/0

cp/dev/pts/0 Test

cp/dev/pts/0/DEV/PTS/1

[Email protected] pts]# echo "Wo shi" >/dev/pts/0
[Email protected] ~]# CP/DEV/PTS/1 b.txt
Fjei
Sfoei
Rifeo
Wfowef
[email protected] ~]# cat B.txt
Fjei
Sfoei
Rifeo
Wfowef

/usr/include/netinet/in.h

/* Structure describing an Internet socket address. */
struct SOCKADDR_IN
{
__sockaddr_common (Sin_);
in_port_t Sin_port;  /* Port number. */
struct IN_ADDR sin_addr;  /* Internet address. */

/* Pad to size of ' struct sockaddr '. */
unsigned char sin_zero[sizeof (struct sockaddr)-
__sockaddr_common_size-
sizeof (in_port_t)-
sizeof (struct in_addr)];
};

/* Ditto, for IPV6. */
struct SOCKADDR_IN6
{
__sockaddr_common (sin6_);
in_port_t Sin6_port; /* Transport Layer Port # */
uint32_t Sin6_flowinfo; /* IPV6 Flow information */
struct IN6_ADDR sin6_addr; /* IPV6 Address */
uint32_t sin6_scope_id; /* IPV6 Scope-id */
};

/usr/include/sys/socket.h

/* Create A new socket of type type in domain domain, using
Protocol protocol. If PROTOCOL is zero, the one is chosen automatically.
Returns a file descriptor for the new socket, or-1 for errors. */
extern int socket (int __domain, int __type, int __protocol) __throw;


Socketpair () system calls can only be used in Unix domain,
/* Create new sockets, of type type in domain domain and using
Protocol protocol, which is connected to all other, and put file
Descriptors for them in fds[0] and fds[1]. If PROTOCOL is zero,
One'll be chosen automatically.  Returns 0 on success,-1 for errors. */
extern int Socketpair (int __domain, int __type, int __protocol,
int __fds[2]) __throw;

Linux Universal IO

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.