os/net/ SocketRecv


See the manpage here for C. See [here](https://docs.python.org/3/library/socket.html#:~:text=socket.recv(bufsize%5B%2C%20flags%5D) for Python. The recv() call is (normally) only used on a connected socket.

C

From the manpage

#include <sys/socket.h>

ssize_t recv(int sockfd, void *buf, size_t len, int flags);
ssize_t recvfrom(int sockfd, void *restrict buf, size_t len, int flags,
                 struct sockaddr *restrict src_addr,
                 socklen_t *restrict addrlen);
ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);

The return value is:

Python

Basically the same as C, except

import socket
s = socket.socket(...)
number_of_bytes = s.recv(size_of_buffer)