socketpair()
[문법]
#include <sys/socket.h>
int socketpair(int domain, int type, int protocol, int sockfd[2]);
[설명]
한 쌍의 연결된 Socket을 만든다.
socket()을 두 번 호출하고, bind(), listen(), connect(), accept()를 호출하는 과정등을 포함하고 있다.
[Parameter]
domain
- AF_UNIX, socketpair는 unix_domain으로만 사용할 수 있다.
type
- SOCK_STREAM Provides sequenced, reliable, two-way, connection-based byte streams. An out-of-band data transmission mechanism may be supported.
- SOCK_DGRAM Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
- SOCK_SEQPACKET Provides a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each input system call.
- SOCK_RAW Provides raw network protocol access.
- SOCK_RDM Provides a reliable datagram layer that does not guarantee ordering.
- SOCK_PACKET Obsolete and should not be used in new programs; see packet(7).
protocol
- socket에서 사용될 특별한 protocol을 명시
sockfd
- 생성될 socket pair를 전달 받을 parameter
'Linux > System Programming' 카테고리의 다른 글
Elf Header, Program Header, Section Header 얻어오기 (0) | 2018.01.02 |
---|---|
[socket] socketpair non-blocking read write (0) | 2017.12.30 |
Warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] (0) | 2016.01.12 |
[프로세스][펌] Daemon Process (0) | 2015.12.09 |
[프로세스 관리] 3. 프로세스 종료 (0) | 2015.08.19 |