Socket Programming Question:
Download Job Interview Questions and Answers PDF
What this function socket() does?
Answer:
Socket Creation Using socket()
#include <sys/types.h>
#include <sys/socket.h>
int socket(int af, int type, int protocol)
socket() is very similar to socketpair() except that only one socket is created instead of two. This is most commonly used if the process you wish to communicate with is not a child process. The af, type, and protocol fields are used just as in the socketpair() system call.
On success, a file descriptor to the socket is returned. On failure, -1 is returned and errno describes the problem.
#include <sys/types.h>
#include <sys/socket.h>
int socket(int af, int type, int protocol)
socket() is very similar to socketpair() except that only one socket is created instead of two. This is most commonly used if the process you wish to communicate with is not a child process. The af, type, and protocol fields are used just as in the socketpair() system call.
On success, a file descriptor to the socket is returned. On failure, -1 is returned and errno describes the problem.
Download Socket Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
What this function socketpair() does? | What this function bind() does? |