<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://spectrum.alioth.net/doc/index.php?action=history&amp;feed=atom&amp;title=Recv</id>
	<title>Recv - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://spectrum.alioth.net/doc/index.php?action=history&amp;feed=atom&amp;title=Recv"/>
	<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Recv&amp;action=history"/>
	<updated>2026-05-16T14:47:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://spectrum.alioth.net/doc/index.php?title=Recv&amp;diff=116&amp;oldid=prev</id>
		<title>Winston: New page: '''recv (HLCALL 0x3E15)''' - receive data from a connected socket  == Synopsis ==  ''Assembly language''   ld a, (sock_fd)  ld de, BUFFER_ADDR  ld bc, BUFFER_SIZE  ld hl, RECV  call HLCALL...</title>
		<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Recv&amp;diff=116&amp;oldid=prev"/>
		<updated>2008-06-19T20:58:55Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;#039;&amp;#039;&amp;#039;recv (HLCALL 0x3E15)&amp;#039;&amp;#039;&amp;#039; - receive data from a connected socket  == Synopsis ==  &amp;#039;&amp;#039;Assembly language&amp;#039;&amp;#039;   ld a, (sock_fd)  ld de, BUFFER_ADDR  ld bc, BUFFER_SIZE  ld hl, RECV  call HLCALL...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''recv (HLCALL 0x3E15)''' - receive data from a connected socket&lt;br /&gt;
&lt;br /&gt;
== Synopsis ==&lt;br /&gt;
&lt;br /&gt;
''Assembly language''&lt;br /&gt;
&lt;br /&gt;
 ld a, (sock_fd)&lt;br /&gt;
 ld de, BUFFER_ADDR&lt;br /&gt;
 ld bc, BUFFER_SIZE&lt;br /&gt;
 ld hl, RECV&lt;br /&gt;
 call HLCALL&lt;br /&gt;
&lt;br /&gt;
''C''&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 ssize_t recv(int sockfd, void *buf, size_t len, int flags);&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The recv call is used only on a connected socket - a SOCK_STREAM socket that has been accepted with [[accept]]() or connected to with [[connect]](). The recv() call receives up to ''len'' bytes of data from the socket specified by ''sockfd'', copying it to the buffer specified by the memory address ''buf''. In the current implementation, the ''flags'' parameter is not used and should be set to 0.&lt;br /&gt;
&lt;br /&gt;
The assembly language function copies data from the socket file descriptor specified in the A register to the memory address pointed to by the DE register pair, up to the number of bytes specified in the BC register pair.&lt;br /&gt;
&lt;br /&gt;
The recv call blocks until data is ready on the socket. If blocking must be avoided, the socket can be checked for ready data using one of the poll routines before recv is called.&lt;br /&gt;
&lt;br /&gt;
== Return values ==&lt;br /&gt;
&lt;br /&gt;
On success, the C routine returns the number of bytes received from the socket. On error, it returns -1.&lt;br /&gt;
&lt;br /&gt;
On success, the assembly language routine returns the number of bytes received in the BC register pair. On error, the carry flag is set and A contains the error number.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spectranet]]&lt;/div&gt;</summary>
		<author><name>Winston</name></author>
	</entry>
</feed>