Dup Ver Goto 📝

SocketRecv

PT2/aw/os/net does not exist
To
27 lines, 109 words, 889 chars Page 'SocketRecv' does not exist.

See the manpage here for C. See here 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)