What this function recvfrom() does?
Submitted by: AdministratorReceiving on a Named Socket - recvfrom()
#include <sys/types.h>
#include <sys/socket.h>
int recvfrom(int s, char *msg, int len, int flags,struct sockaddr *from, int *fromlen)
This function allows a message msg of maximum length len to be read from a socket with descriptor s from the socket named by from and fromlen, where fromlen is the actual length of from. The number of characters actually read from the socket is the return value of the function. On error, -1 is returned and errno describes the error. flags may be 0, or may specify MSG_PEEK to examine a message without actually receiving it from the queue.
If no message is available to be read, the process will suspend waiting for one unless the socket is set to nonblocking mode (via an ioctl call).
The system I/O call read() can also be used to read data from a socket.
Submitted by: Administrator
#include <sys/types.h>
#include <sys/socket.h>
int recvfrom(int s, char *msg, int len, int flags,struct sockaddr *from, int *fromlen)
This function allows a message msg of maximum length len to be read from a socket with descriptor s from the socket named by from and fromlen, where fromlen is the actual length of from. The number of characters actually read from the socket is the return value of the function. On error, -1 is returned and errno describes the error. flags may be 0, or may specify MSG_PEEK to examine a message without actually receiving it from the queue.
If no message is available to be read, the process will suspend waiting for one unless the socket is set to nonblocking mode (via an ioctl call).
The system I/O call read() can also be used to read data from a socket.
Submitted by: Administrator
Read Online Socket Programming Job Interview Questions And Answers
Top Socket Programming Questions
☺ | Socket Programming Interview Questions |
☺ | How does the race condition occur? |
☺ | What Is Socket? |
☺ | Socket Programming in C using TCP with Code? |
☺ | What is the difference between TCP and UDP? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |