COMPUTER NETWORKING

APPLICATION LAYER

SOCKET INTERFACE PROGRAMMING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The correct syntax for receive socket is ____
A
int status = recv(sockid, &foreignAddr, addrlen);
B
int count = recv(sockid, recvBuf, bufLen, flags);
C
int count = recv(sockid, msg, msgLen, flags);
D
int s = recv(sockid, &clientAddr, &addrLen);
Explanation: 

Detailed explanation-1: -The recv() function shall return the length of the message written to the buffer pointed to by the buffer argument. For message-based sockets, such as SOCK DGRAM and SOCK SEQPACKET, the entire message shall be read in a single operation.

Detailed explanation-2: -The recv function is used to read incoming data on connection-oriented sockets, or connectionless sockets. When using a connection-oriented protocol, the sockets must be connected before calling recv. When using a connectionless protocol, the sockets must be bound before calling recv.

There is 1 question to complete.