<?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=Recvfrom</id>
	<title>Recvfrom - 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=Recvfrom"/>
	<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Recvfrom&amp;action=history"/>
	<updated>2026-05-03T18:17:06Z</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=Recvfrom&amp;diff=145&amp;oldid=prev</id>
		<title>Winston: New page: '''recvfrom (IXCALL 0x3E1B)''' - receive a message from a socket  == Synopsis ==  ''Assembly language''      ld a, (v_sockfd)     ld hl, BUF_CONNINFO     ld de, BUF_DATA     ld bc, BUF_DAT...</title>
		<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Recvfrom&amp;diff=145&amp;oldid=prev"/>
		<updated>2008-08-16T10:51:15Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;#039;&amp;#039;&amp;#039;recvfrom (IXCALL 0x3E1B)&amp;#039;&amp;#039;&amp;#039; - receive a message from a socket  == Synopsis ==  &amp;#039;&amp;#039;Assembly language&amp;#039;&amp;#039;      ld a, (v_sockfd)     ld hl, BUF_CONNINFO     ld de, BUF_DATA     ld bc, BUF_DAT...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''recvfrom (IXCALL 0x3E1B)''' - receive a message from a socket&lt;br /&gt;
&lt;br /&gt;
== Synopsis ==&lt;br /&gt;
&lt;br /&gt;
''Assembly language''&lt;br /&gt;
&lt;br /&gt;
    ld a, (v_sockfd)&lt;br /&gt;
    ld hl, BUF_CONNINFO&lt;br /&gt;
    ld de, BUF_DATA&lt;br /&gt;
    ld bc, BUF_DATA_LEN&lt;br /&gt;
    ld ix, RECVFROM&lt;br /&gt;
    call IXCALL&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;
    int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr_in *from, socklen_t *fromlen);&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The '''recvfrom()''' call is used to receive messages from a socket, and may be used to receive data on a socket whether or not it is connection-oriented. The recvfrom() call is typically used with UDP (SOCK_DGRAM) sockets to receive a datagram from the remote host.&lt;br /&gt;
&lt;br /&gt;
The socket is specified by the ''sockfd'' parameter. The ''buf'' parameter is a pointer to a buffer which should be filled with the data from the remote host, and the ''len'' parameter specifies the maximum number of bytes that may be copied into this buffer. In the current implementation, the ''flags'' parameter is not used. The ''from'' parameter is a pointer to a struct sockaddr_in, and this structure will be filled with information about the remote host that sent the datagram that is being received. The ''fromlen'' parameter specifies the size of the structure; it is currently unused since the only structure type that is valid for this call is a struct sockaddr_in, and is provided to give compatibility with the BSD socket library specification.&lt;br /&gt;
&lt;br /&gt;
For the assembly language interface, the socket is specified in the A register, the register pair DE contains the address in memory where the received data should be written, and the BC register pair contains the maximum number of bytes that may be copied into this area of memory. The HL register pair points to a location in memory where the information about the remote host may be copied. The connection information is 8 bytes long, so the memory location contained in HL must be a location with at least 8 bytes free. The assembly language interface fills the memory pointed to by HL in the following format:&lt;br /&gt;
&lt;br /&gt;
 bytes 0,1,2,3 - the remote host's IP address&lt;br /&gt;
 bytes 4,5     - the remote host's port number&lt;br /&gt;
 bytes 6,7     - the local host's port number&lt;br /&gt;
&lt;br /&gt;
== Return values ==&lt;br /&gt;
&lt;br /&gt;
On return, the C interface returns the number of bytes actually received, or -1 if an error occurred.&lt;br /&gt;
&lt;br /&gt;
The assembly language interface returns the number of bytes received in BC on success. On error, the carry flag is set and the A register contains the error code.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spectranet]]&lt;/div&gt;</summary>
		<author><name>Winston</name></author>
	</entry>
</feed>