NET Accept

From Bennu Wiki
Revision as of 07:43, 23 November 2009 by Sandman (talk | contribs) (Created page with 'Category:functions Category:libnetwork Category:dll '''Up to Network.DLL Functions''' ---- ==Definition== '''INT''' NET_Accept ( <'…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Up to Network.DLL Functions



Definition

INT NET_Accept ( <WORD listen_connection> )

Waits for a new incoming connection on the specified listening connection. The connection identifier of the new incoming connection is returned. Waiting means that this function DOES NOT return until an incoming connection is made.

Parameters

WORD listen_connection - The connection identifier of the listening connection on which a new incoming connection is expected.

Returns

INT : Network.DLL Errorcode

NET_ERROR_INVALIDCONN - The connection is invalid.
NET_ERROR_CONNINACTIVE - The connection is inactive.
0 - n - Connection identifier of the incoming connection on the specified listening connection. (Where n is the number of maximum allowed connections)

Example

As an example, here is the code for NET_Accept():

Function int NET_Accept(word listen_conn);
Begin

/* Checks */

	if(listen_conn>=NET.maxlistenports)
		if(NET.consolereports)
			NET_ConsoleMessage(listen_conn,"Error: Connection " + listen_conn + " invalid");
		end
		return NET_ERROR_INVALIDCONN;
	end
	if(NET.Status[listen_conn]<=NET_STATUS_INACTIVE)
		if(NET.consolereports)
			NET_ConsoleMessage(listen_conn,"Error: Connection " + listen_conn + " not active");
		end
		return NET_ERROR_CONNINACTIVE;
	end

/* Wait for new connection */

	While(NET.Incoming[listen_conn]!=NET_STATUS_ESTABLISHED)
		frame;
	End
	listen_conn = net_incoming_accept(listen_conn);

	return listen_conn;

End

Used in example: NET.Incoming, NET_Incoming_Accept()


Network.DLL Functions
Global NET_Init() • NET_Quit() • NET_Version() • NET_IntVersion() • NET_About() • NET_GetError() • NET_Stat_Buffer() • NET_IntToIP() • NET_IPToInt()
Connections NET_Connect() • NET_Listen() • NET_Disconnect() • NET_DisconnectAll() • NET_Accept() • NET_Incoming_Accept()
Connection NET_Resolve() • NET_Hostname() • NET_IPAddress() • NET_Port() • NET_Separator() • NET_GetSeparator() • NET_GetSeparatorLength()
Transfer NET_Recv() • NET_RecvFile() • NET_RecvGraph() • NET_RecvVar() • NET_Send() • NET_SendFile() • NET_SendGraph() • NET_SendRN() • NET_SendVar()