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>nn::socket::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 uptr bufferAddress, 16 size_t bufferSize, 17 s32 bufferSizeForSockets, 18 s32 maxSessions 19); 20</pre> 21 </div> 22<h2>Arguments</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 <a href="../../nn/socket/GetAddrInfo.html"><CODE>GetAddrInfo</CODE></a> 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/receive buffers. You can use the <a href="../../nn/socket/SetSockOpt.html"><CODE>SetSockOpt</CODE></a> function to specify the send/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 approximately 64 KB.<br /> <B>Note:</B> The default buffer size may be subject to change.</td> 46 </tr> 47 <tr> 48<td>in</td> 49<th>maxSessions</th> 50<td>Specifies the number of threads that use the socket functions. You cannot call blocking socket functions from more than this number of threads. Strictly speaking, it is possible to call socket functions from more than this number of threads as long as the threads do not simultaneously call blocking functions. However, this is not recommended. <br /><br />When called, both synchronous and asynchronous functions will block until there are enough usable sessions. Functions continue to block until there are free sessions, even if conditions to unblock have been satisfied (for example, if the functions have finished sending or receiving data). <br /><br /><B>Note:</B> This causes asynchronous operations to behave synchronously. <br /><br />You can check the state of multiple sockets with a single call to the <a href="../../nn/socket/Poll.html"><CODE>Poll</CODE></a> function. This allows 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>