Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.44 KB

recv.md

File metadata and controls

63 lines (45 loc) · 1.44 KB

Home

Function name : recv

Group: Windows Sockets 2 (Winsock) - Library: ws2_32


The recv function receives data from a connected or bound socket.


Code examples:

Winsock: retrieving Web pages using sockets (HTTP, port 80)
Winsock: sending email messages (SMTP, port 25)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Winsock: reading email messages (POP3, port 110)
Winsock: connecting to a news server (NNTP, port 119)
How to create non-blocking Winsock server

Declaration:

int recv(
  SOCKET s,
  char* buf,
  int len,
  int flags
);
  

FoxPro declaration:

DECLARE INTEGER recv IN ws2_32;
	INTEGER   s,;
	STRING  @ buf,;
	INTEGER   buflen,;
	INTEGER   flags
  

Parameters:

s [in] Descriptor identifying a connected socket.

buf [out] Buffer for the incoming data.

len [in] Length of buf, in bytes

flags [in] Flag specifying the way in which the call is made.


Return value:

If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero.