<?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=Accept</id>
	<title>Accept - 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=Accept"/>
	<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Accept&amp;action=history"/>
	<updated>2026-04-28T19:24:22Z</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=Accept&amp;diff=106&amp;oldid=prev</id>
		<title>Winston: New page: '''accept (HLCALL 0x3E09)''' - accept a connection on a socket.  == Synopsis ==  ''Assembly language''   ld a, (listen_sockfd)       ; get the listening socket handle  ld hl, ACCEPT  call ...</title>
		<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Accept&amp;diff=106&amp;oldid=prev"/>
		<updated>2008-06-03T22:26:10Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;#039;&amp;#039;&amp;#039;accept (HLCALL 0x3E09)&amp;#039;&amp;#039;&amp;#039; - accept a connection on a socket.  == Synopsis ==  &amp;#039;&amp;#039;Assembly language&amp;#039;&amp;#039;   ld a, (listen_sockfd)       ; get the listening socket handle  ld hl, ACCEPT  call ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''accept (HLCALL 0x3E09)''' - accept a connection on 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, (listen_sockfd)       ; get the listening socket handle&lt;br /&gt;
 ld hl, ACCEPT&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;
 int accept(int s, struct sockaddr *addr, socklen_t *addrlen);&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The argument s is a socket that has been created with [[socket]], bound to&lt;br /&gt;
an address with [[bind]], and is listening for connections after a&lt;br /&gt;
[[listen]].  The accept() call extracts the first connection request on&lt;br /&gt;
the queue of pending connections, creates a new socket with the same&lt;br /&gt;
properties of s, and allocates a new file descriptor for the socket.  If&lt;br /&gt;
no pending connections are present on the queue, accept() blocks the caller until a connection is&lt;br /&gt;
present. The accepted socket may not be used to accept more connections.  The&lt;br /&gt;
original socket s remains open.&lt;br /&gt;
&lt;br /&gt;
The argument addr is a result parameter that is filled in with the address of the connecting entity as known to the communications layer, which for the Spectranet is only sockaddr_in. Assembly language programmers may use the [[getsockinfo]] call to fill a block of memory with the address information.&lt;br /&gt;
&lt;br /&gt;
It is possible to [[poll]] a socket for the purposes of doing an accept() by selecting it for read.&lt;br /&gt;
&lt;br /&gt;
== Return values ==&lt;br /&gt;
&lt;br /&gt;
On success, the C accept() call returns 0, and on error, -1. The assembly language call returns with the carry flag reset on success, and carry set on error with the A register set to the error code.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spectranet]]&lt;/div&gt;</summary>
		<author><name>Winston</name></author>
	</entry>
</feed>