1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../css/manpage.css" type="text/css" /> 7<title>Initialize</title> 8 </head> 9 <body> 10<h1><CODE><a href="../../nn/Overview.html">nn</a>::<a href="../../nn/socket/Overview.html">socket</a>::Initialize</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14<a href="../../nn/Result/Overview.html">Result</a> Initialize( 15 <a href="../../nn_types/uptr.html">uptr</a> bufferAddress, 16 size_t bufferSize, 17 <a href="../../nn_types/s32.html">s32</a> bufferSizeForSockets, 18 <a href="../../nn_types/s32.html">s32</a> maxSessions 19); 20</pre> 21 </div> 22<h2>Parameters</h2> 23 <div class="section"> 24 <table class="arguments"> 25 <thead> 26 <tr> 27 <td width="15" /> 28<th>Name</th> 29<td>Description</td> 30 </tr> 31 </thead> 32 <tr> 33<td>in</td> 34<th>bufferAddress</th> 35<td>Specifies the address of the working region used by the socket library. Must be 4096-byte aligned. Device memory cannot be used.</td> 36 </tr> 37 <tr> 38<td>in</td> 39<th>bufferSize</th> 40<td>Specifies the size of the working region. The size of the working region must be greater than or equal to the size returned by the <a href="../../nn/socket/GetRequiredMemorySize.html"><CODE>GetRequiredMemorySize</CODE></a> function. Although you can normally use this value unchanged, specify a larger size as necessary when you allocate a large number of <a href="../../nn/socket/AddrInfo/Overview.html"><CODE>AddrInfo</CODE></a> instances with the <CODE>GetAddrInfo</CODE> function.</td> 41 </tr> 42 <tr> 43<td>in</td> 44<th>bufferSizeForSockets</th> 45<td>Specifies how much of the working region to use for assigning socket send and receive buffers. Use the <CODE>SetSockOpt</CODE> function to specify the send and receive buffer for each socket. By default, 16 KB are assigned for a single TCP socket (8 KB for sending and 8 KB for receiving) and 32 KB are assigned for a single UDP socket. Even if you only use a single socket, allocate at least 64 KB. <br /> <B>Note:</B> The default buffer size may be changed in the future.</td> 46 </tr> 47 <tr> 48<td>in</td> 49<th>maxSessions</th> 50<td>Specifies the number of threads that use socket functions. A single session is consumed for calls from a single thread. You cannot call blocking socket functions from more than this number of threads. Socket functions can technically be called from more than this number of threads as long as the threads do not call blocking functions simultaneously, but it is not recommended. Both synchronous and asynchronous functions return an <CODE>EBUSY</CODE> error when they are called until there are enough available sessions. To check the state of multiple sockets, make a single call to the <CODE>Poll</CODE> function. This enables you to reduce the number of threads that use socket functions.</td> 51 </tr> </table> 52 </div> 53<h2>Return Values</h2> 54<div class="section">The result of processing. </div> 55<h2>Description</h2> 56 <div class="section"> 57<p>Initializes the socket library, allowing socket API functions to be called.</p> 58 </div> 59 <hr><p>CONFIDENTIAL</p></body> 60</html> 61