892 lines
69 KiB
HTML
892 lines
69 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<!-- This file is generated by Nim. -->
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
|
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
|
|
|
<!-- Google fonts -->
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
|
|
<!-- CSS -->
|
|
<title>sdl2/sdl2_net</title>
|
|
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
|
|
|
|
<script type="text/javascript" src="dochack.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function main() {
|
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
|
for (var i = 0; i < pragmaDots.length; i++) {
|
|
pragmaDots[i].onclick = function(event) {
|
|
// Hide tease
|
|
event.target.parentNode.style.display = "none";
|
|
// Show actual
|
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
|
}
|
|
}
|
|
|
|
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
|
function switchTheme(e) {
|
|
if (e.target.checked) {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
}
|
|
|
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
|
|
|
|
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
document.documentElement.setAttribute('data-theme', "dark");
|
|
toggleSwitch.checked = true;
|
|
} else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
document.documentElement.setAttribute('data-theme', "light");
|
|
toggleSwitch.checked = false;
|
|
} else {
|
|
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
|
|
if (currentTheme) {
|
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
|
|
|
if (currentTheme === 'dark') {
|
|
toggleSwitch.checked = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body onload="main()">
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">sdl2/sdl2_net</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-switch-wrapper">
|
|
<label class="theme-switch" for="checkbox">
|
|
<input type="checkbox" id="checkbox" />
|
|
<div class="slider round"></div>
|
|
</label>
|
|
<em>Dark Mode</em>
|
|
</div>
|
|
<div id="global-links">
|
|
<ul class="simple">
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#Version"
|
|
title="Version = sdl2.Version"><wbr />Version<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#IPaddress"
|
|
title="IPaddress {.bycopy.} = object
|
|
host*: Uint32 ## ::
|
|
## 32-bit IPv4 host address
|
|
port*: Uint16 ## ::
|
|
## 16-bit protocol port"><wbr />IPaddress<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#TCPsocket"
|
|
title="TCPsocket {.incompleteStruct.} = object"><wbr />TCPsocket<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#UDPsocket"
|
|
title="UDPsocket {.incompleteStruct.} = object"><wbr />UDPsocket<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#UDPpacket"
|
|
title="UDPpacket {.bycopy.} = object
|
|
channel*: cint ## ::
|
|
## The src/dst channel of the packet
|
|
data*: ptr Uint8 ## ::
|
|
## The packet data
|
|
len*: cint ## ::
|
|
## The length of the packet data
|
|
maxlen*: cint ## ::
|
|
## The size of the data buffer
|
|
status*: cint ## ::
|
|
## packet status after sending
|
|
address*: IPaddress ## ::
|
|
## The source/dest address of an incoming/outgoing packet"><wbr />UDPpacket<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SocketSet"
|
|
title="SocketSet {.incompleteStruct.} = object"><wbr />Socket<wbr />Set<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#GenericSocket"
|
|
title="GenericSocket {.bycopy.} = object
|
|
ready*: cint"><wbr />Generic<wbr />Socket<span class="attachedType"></span></a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#10" id="60">Consts</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#SDLnetStd"
|
|
title="SDLnetStd = false"><wbr />SDLnet<wbr />Std<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetGit"
|
|
title="SDLnetGit = false"><wbr />SDLnet<wbr />Git<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetDL"
|
|
title="SDLnetDL = true"><wbr />SDLnet<wbr />DL<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetStatic"
|
|
title="SDLnetStatic = true"><wbr />SDLnet<wbr />Static<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetSetVer"
|
|
title="SDLnetSetVer = """><wbr />SDLnet<wbr />Set<wbr />Ver<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetLPath"
|
|
title="SDLnetLPath = "/Users/joey/Projects/nim-sdl2/src/build/sdl2_net/.libs/libSDL2_net.a""><wbr />SDLnet<wbr />LPath<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLnetPath"
|
|
title="SDLnetPath = "/Users/joey/Projects/nim-sdl2/src/build/sdl2_net/SDL_net.h""><wbr />SDLnet<wbr />Path<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#NET_MAJOR_VERSION"
|
|
title="NET_MAJOR_VERSION = 2"><wbr />NET_<wbr />MAJOR_<wbr />VERSION<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#NET_MINOR_VERSION"
|
|
title="NET_MINOR_VERSION = 0"><wbr />NET_<wbr />MINOR_<wbr />VERSION<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#NET_PATCHLEVEL"
|
|
title="NET_PATCHLEVEL = 1"><wbr />NET_<wbr />PATCHLEVEL<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#INADDR_ANY"
|
|
title="INADDR_ANY = 0x00000000"><wbr />INADDR_<wbr />ANY<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#INADDR_NONE"
|
|
title="INADDR_NONE = 0x00000000FFFFFFFF'i64"><wbr />INADDR_<wbr />NONE<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#INADDR_LOOPBACK"
|
|
title="INADDR_LOOPBACK = 0x7F000001"><wbr />INADDR_<wbr />LOOPBACK<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#INADDR_BROADCAST"
|
|
title="INADDR_BROADCAST = 0x00000000FFFFFFFF'i64"><wbr />INADDR_<wbr />BROADCAST<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLNET_MAX_UDPCHANNELS"
|
|
title="SDLNET_MAX_UDPCHANNELS = 32"><wbr />SDLNET_<wbr />MAX_<wbr />UDPCHANNELS<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SDLNET_MAX_UDPADDRESSES"
|
|
title="SDLNET_MAX_UDPADDRESSES = 4"><wbr />SDLNET_<wbr />MAX_<wbr />UDPADDRESSES<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#DATA_ALIGNED"
|
|
title="DATA_ALIGNED = 0"><wbr />DATA_<wbr />ALIGNED<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#INVALID_SOCKET"
|
|
title="INVALID_SOCKET = -1"><wbr />INVALID_<wbr />SOCKET<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#SOCKET_ERROR"
|
|
title="SOCKET_ERROR = -1"><wbr />SOCKET_<wbr />ERROR<span class="attachedType"></span></a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#linked_Version"
|
|
title="linked_Version(): ptr Version"><wbr />linked_<wbr />Version<span class="attachedType">Version</span></a></li>
|
|
<li><a class="reference" href="#init"
|
|
title="init(): cint"><wbr />init<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#quit"
|
|
title="quit()"><wbr />quit<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#resolveHost%2Cptr.IPaddress%2Ccstring%2CUint16"
|
|
title="resolveHost(address: ptr IPaddress; host: cstring; port: Uint16): cint"><wbr />resolve<wbr />Host<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#resolveIP%2Cptr.IPaddress"
|
|
title="resolveIP(ip: ptr IPaddress): cstring"><wbr />resolve<wbr />IP<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#getLocalAddresses%2Cptr.IPaddress%2Ccint"
|
|
title="getLocalAddresses(addresses: ptr IPaddress; maxcount: cint): cint"><wbr />get<wbr />Local<wbr />Addresses<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_Open%2Cptr.IPaddress"
|
|
title="tCP_Open(ip: ptr IPaddress): TCPsocket"><wbr />t<wbr />CP_<wbr />Open<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_Accept%2CTCPsocket"
|
|
title="tCP_Accept(server: TCPsocket): TCPsocket"><wbr />t<wbr />CP_<wbr />Accept<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_GetPeerAddress%2CTCPsocket"
|
|
title="tCP_GetPeerAddress(sock: TCPsocket): ptr IPaddress"><wbr />t<wbr />CP_<wbr />Get<wbr />Peer<wbr />Address<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_Send%2CTCPsocket%2Cpointer%2Ccint"
|
|
title="tCP_Send(sock: TCPsocket; data: pointer; len: cint): cint"><wbr />t<wbr />CP_<wbr />Send<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_Recv%2CTCPsocket%2Cpointer%2Ccint"
|
|
title="tCP_Recv(sock: TCPsocket; data: pointer; maxlen: cint): cint"><wbr />t<wbr />CP_<wbr />Recv<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#tCP_Close%2CTCPsocket"
|
|
title="tCP_Close(sock: TCPsocket)"><wbr />t<wbr />CP_<wbr />Close<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#allocPacket%2Ccint"
|
|
title="allocPacket(size: cint): ptr UDPpacket"><wbr />alloc<wbr />Packet<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#resizePacket%2Cptr.UDPpacket%2Ccint"
|
|
title="resizePacket(packet: ptr UDPpacket; newsize: cint): cint"><wbr />resize<wbr />Packet<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#freePacket%2Cptr.UDPpacket"
|
|
title="freePacket(packet: ptr UDPpacket)"><wbr />free<wbr />Packet<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#allocPacketV%2Ccint%2Ccint"
|
|
title="allocPacketV(howmany: cint; size: cint): ptr ptr UDPpacket"><wbr />alloc<wbr />Packet<wbr />V<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#freePacketV%2Cptr.ptr.UDPpacket"
|
|
title="freePacketV(packetV: ptr ptr UDPpacket)"><wbr />free<wbr />Packet<wbr />V<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Open%2CUint16"
|
|
title="uDP_Open(port: Uint16): UDPsocket"><wbr />u<wbr />DP_<wbr />Open<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_SetPacketLoss%2CUDPsocket%2Ccint"
|
|
title="uDP_SetPacketLoss(sock: UDPsocket; percent: cint)"><wbr />u<wbr />DP_<wbr />Set<wbr />Packet<wbr />Loss<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Bind%2CUDPsocket%2Ccint%2Cptr.IPaddress"
|
|
title="uDP_Bind(sock: UDPsocket; channel: cint; address: ptr IPaddress): cint"><wbr />u<wbr />DP_<wbr />Bind<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Unbind%2CUDPsocket%2Ccint"
|
|
title="uDP_Unbind(sock: UDPsocket; channel: cint)"><wbr />u<wbr />DP_<wbr />Unbind<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_GetPeerAddress%2CUDPsocket%2Ccint"
|
|
title="uDP_GetPeerAddress(sock: UDPsocket; channel: cint): ptr IPaddress"><wbr />u<wbr />DP_<wbr />Get<wbr />Peer<wbr />Address<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_SendV%2CUDPsocket%2Cptr.ptr.UDPpacket%2Ccint"
|
|
title="uDP_SendV(sock: UDPsocket; packets: ptr ptr UDPpacket; npackets: cint): cint"><wbr />u<wbr />DP_<wbr />Send<wbr />V<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Send%2CUDPsocket%2Ccint%2Cptr.UDPpacket"
|
|
title="uDP_Send(sock: UDPsocket; channel: cint; packet: ptr UDPpacket): cint"><wbr />u<wbr />DP_<wbr />Send<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_RecvV%2CUDPsocket%2Cptr.ptr.UDPpacket"
|
|
title="uDP_RecvV(sock: UDPsocket; packets: ptr ptr UDPpacket): cint"><wbr />u<wbr />DP_<wbr />Recv<wbr />V<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Recv%2CUDPsocket%2Cptr.UDPpacket"
|
|
title="uDP_Recv(sock: UDPsocket; packet: ptr UDPpacket): cint"><wbr />u<wbr />DP_<wbr />Recv<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#uDP_Close%2CUDPsocket"
|
|
title="uDP_Close(sock: UDPsocket)"><wbr />u<wbr />DP_<wbr />Close<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#allocSocketSet%2Ccint"
|
|
title="allocSocketSet(maxsockets: cint): SocketSet"><wbr />alloc<wbr />Socket<wbr />Set<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#addSocket%2CSocketSet%2CGenericSocket"
|
|
title="addSocket(set: SocketSet; sock: GenericSocket): cint"><wbr />add<wbr />Socket<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#delSocket%2CSocketSet%2CGenericSocket"
|
|
title="delSocket(set: SocketSet; sock: GenericSocket): cint"><wbr />del<wbr />Socket<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#checkSockets%2CSocketSet%2CUint32"
|
|
title="checkSockets(set: SocketSet; timeout: Uint32): cint"><wbr />check<wbr />Sockets<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#freeSocketSet%2CSocketSet"
|
|
title="freeSocketSet(set: SocketSet)"><wbr />free<wbr />Socket<wbr />Set<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#setError%2Ccstring"
|
|
title="setError(fmt: cstring)"><wbr />set<wbr />Error<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#getError"
|
|
title="getError(): cstring"><wbr />get<wbr />Error<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#getLastError"
|
|
title="getLastError(): cint"><wbr />get<wbr />Last<wbr />Error<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#setLastError%2Ccint"
|
|
title="setLastError(err: cint)"><wbr />set<wbr />Last<wbr />Error<span class="attachedType"></span></a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc"></p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="sdl2.html">sdl2</a>
|
|
</dl></div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<a id="Version"></a>
|
|
<dt><pre><a href="sdl2_net.html#Version"><span class="Identifier">Version</span></a> <span class="Other">=</span> <span class="Identifier">sdl2</span><span class="Other">.</span><span class="Identifier">Version</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="IPaddress"></a>
|
|
<dt><pre><a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">bycopy</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">host</span><span class="Operator">*</span><span class="Other">:</span> <a href="sdl2.html#Uint32"><span class="Identifier">Uint32</span></a> <span class="Comment">## ::</span>
|
|
<span class="Comment">## 32-bit IPv4 host address</span>
|
|
<span class="Identifier">port</span><span class="Operator">*</span><span class="Other">:</span> <a href="sdl2.html#Uint16"><span class="Identifier">Uint16</span></a> <span class="Comment">## ::</span>
|
|
<span class="Comment">## 16-bit protocol port</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
<pre>
|
|
IPv4 hostname resolution API</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="TCPsocket"></a>
|
|
<dt><pre><a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">incompleteStruct</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="UDPsocket"></a>
|
|
<dt><pre><a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">incompleteStruct</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="UDPpacket"></a>
|
|
<dt><pre><a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">bycopy</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">channel</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Comment">## ::</span>
|
|
<span class="Comment">## The src/dst channel of the packet</span>
|
|
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2.html#Uint8"><span class="Identifier">Uint8</span></a> <span class="Comment">## ::</span>
|
|
<span class="Comment">## The packet data</span>
|
|
<span class="Identifier">len</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Comment">## ::</span>
|
|
<span class="Comment">## The length of the packet data</span>
|
|
<span class="Identifier">maxlen</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Comment">## ::</span>
|
|
<span class="Comment">## The size of the data buffer</span>
|
|
<span class="Identifier">status</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Comment">## ::</span>
|
|
<span class="Comment">## packet status after sending</span>
|
|
<span class="Identifier">address</span><span class="Operator">*</span><span class="Other">:</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a> <span class="Comment">## ::</span>
|
|
<span class="Comment">## The source/dest address of an incoming/outgoing packet</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SocketSet"></a>
|
|
<dt><pre><a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">incompleteStruct</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="GenericSocket"></a>
|
|
<dt><pre><a href="sdl2_net.html#GenericSocket"><span class="Identifier">GenericSocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">bycopy</span></span><span class="Other">.}</span></span> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">ready</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cint</span>
|
|
</pre></dt>
|
|
<dd>
|
|
|
|
<pre>Any network socket can be safely cast to this socket type</pre>
|
|
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
<div class="section" id="10">
|
|
<h1><a class="toc-backref" href="#10">Consts</a></h1>
|
|
<dl class="item">
|
|
<a id="SDLnetStd"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetStd"><span class="Identifier">SDLnetStd</span></a> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetGit"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetGit"><span class="Identifier">SDLnetGit</span></a> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetDL"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetDL"><span class="Identifier">SDLnetDL</span></a> <span class="Other">=</span> <span class="DecNumber">true</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetStatic"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetStatic"><span class="Identifier">SDLnetStatic</span></a> <span class="Other">=</span> <span class="DecNumber">true</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetSetVer"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetSetVer"><span class="Identifier">SDLnetSetVer</span></a> <span class="Other">=</span> <span class="StringLit">""</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetLPath"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetLPath"><span class="Identifier">SDLnetLPath</span></a> <span class="Other">=</span> <span class="StringLit">"/Users/joey/Projects/nim-sdl2/src/build/sdl2_net/.libs/libSDL2_net.a"</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLnetPath"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLnetPath"><span class="Identifier">SDLnetPath</span></a> <span class="Other">=</span> <span class="StringLit">"/Users/joey/Projects/nim-sdl2/src/build/sdl2_net/SDL_net.h"</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="NET_MAJOR_VERSION"></a>
|
|
<dt><pre><a href="sdl2_net.html#NET_MAJOR_VERSION"><span class="Identifier">NET_MAJOR_VERSION</span></a> <span class="Other">=</span> <span class="DecNumber">2</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="NET_MINOR_VERSION"></a>
|
|
<dt><pre><a href="sdl2_net.html#NET_MINOR_VERSION"><span class="Identifier">NET_MINOR_VERSION</span></a> <span class="Other">=</span> <span class="DecNumber">0</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="NET_PATCHLEVEL"></a>
|
|
<dt><pre><a href="sdl2_net.html#NET_PATCHLEVEL"><span class="Identifier">NET_PATCHLEVEL</span></a> <span class="Other">=</span> <span class="DecNumber">1</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="INADDR_ANY"></a>
|
|
<dt><pre><a href="sdl2_net.html#INADDR_ANY"><span class="Identifier">INADDR_ANY</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000000</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="INADDR_NONE"></a>
|
|
<dt><pre><a href="sdl2_net.html#INADDR_NONE"><span class="Identifier">INADDR_NONE</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000000FFFFFFFF'i64</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="INADDR_LOOPBACK"></a>
|
|
<dt><pre><a href="sdl2_net.html#INADDR_LOOPBACK"><span class="Identifier">INADDR_LOOPBACK</span></a> <span class="Other">=</span> <span class="DecNumber">0x7F000001</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="INADDR_BROADCAST"></a>
|
|
<dt><pre><a href="sdl2_net.html#INADDR_BROADCAST"><span class="Identifier">INADDR_BROADCAST</span></a> <span class="Other">=</span> <span class="DecNumber">0x00000000FFFFFFFF'i64</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLNET_MAX_UDPCHANNELS"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLNET_MAX_UDPCHANNELS"><span class="Identifier">SDLNET_MAX_UDPCHANNELS</span></a> <span class="Other">=</span> <span class="DecNumber">32</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SDLNET_MAX_UDPADDRESSES"></a>
|
|
<dt><pre><a href="sdl2_net.html#SDLNET_MAX_UDPADDRESSES"><span class="Identifier">SDLNET_MAX_UDPADDRESSES</span></a> <span class="Other">=</span> <span class="DecNumber">4</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="DATA_ALIGNED"></a>
|
|
<dt><pre><a href="sdl2_net.html#DATA_ALIGNED"><span class="Identifier">DATA_ALIGNED</span></a> <span class="Other">=</span> <span class="DecNumber">0</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="INVALID_SOCKET"></a>
|
|
<dt><pre><a href="sdl2_net.html#INVALID_SOCKET"><span class="Identifier">INVALID_SOCKET</span></a> <span class="Other">=</span> <span class="DecNumber">-1</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="SOCKET_ERROR"></a>
|
|
<dt><pre><a href="sdl2_net.html#SOCKET_ERROR"><span class="Identifier">SOCKET_ERROR</span></a> <span class="Other">=</span> <span class="DecNumber">-1</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
<div class="section" id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<a id="linked_Version"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#linked_Version"><span class="Identifier">linked_Version</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#Version"><span class="Identifier">Version</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_Linked_Version"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>This function gets the version of the dynamically linked SDL_net library.
|
|
it should NOT be used to fill a version structure, instead you should
|
|
use the SDL_NET_VERSION() macro.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="init"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#init"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_Init"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Initialize/Cleanup the network API
|
|
SDL must be initialized before calls to functions in this library,
|
|
because this library uses utility functions from the SDL library.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="quit"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#quit"><span class="Identifier">quit</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_Quit"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="resolveHost,ptr.IPaddress,cstring,Uint16"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#resolveHost%2Cptr.IPaddress%2Ccstring%2CUint16"><span class="Identifier">resolveHost</span></a><span class="Other">(</span><span class="Identifier">address</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a><span class="Other">;</span> <span class="Identifier">host</span><span class="Other">:</span> <span class="Identifier">cstring</span><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="sdl2.html#Uint16"><span class="Identifier">Uint16</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_ResolveHost"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="resolveIP,ptr.IPaddress"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#resolveIP%2Cptr.IPaddress"><span class="Identifier">resolveIP</span></a><span class="Other">(</span><span class="Identifier">ip</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cstring</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_ResolveIP"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Resolve an ip address to a host name in canonical form.
|
|
If the ip couldn't be resolved, this function returns NULL,
|
|
otherwise a pointer to a static buffer containing the hostname
|
|
is returned. Note that this function is not thread-safe.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="getLocalAddresses,ptr.IPaddress,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getLocalAddresses%2Cptr.IPaddress%2Ccint"><span class="Identifier">getLocalAddresses</span></a><span class="Other">(</span><span class="Identifier">addresses</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a><span class="Other">;</span> <span class="Identifier">maxcount</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_GetLocalAddresses"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Get the addresses of network interfaces on this system.
|
|
This returns the number of addresses saved in 'addresses'</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_Open,ptr.IPaddress"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_Open%2Cptr.IPaddress"><span class="Identifier">tCP_Open</span></a><span class="Other">(</span><span class="Identifier">ip</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a><span class="Other">)</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_Open"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Open a TCP network socket
|
|
If ip.host is INADDR_NONE or INADDR_ANY, this creates a local server
|
|
socket on the given port, otherwise a TCP connection to the remote
|
|
host and port is attempted. The address passed in should already be
|
|
swapped to network byte order (addresses returned from
|
|
SDLNet_ResolveHost() are already in the correct form).
|
|
The newly created socket is returned, or NULL if there was an error.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_Accept,TCPsocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_Accept%2CTCPsocket"><span class="Identifier">tCP_Accept</span></a><span class="Other">(</span><span class="Identifier">server</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_Accept"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Accept an incoming connection on the given server socket.
|
|
The newly created socket is returned, or NULL if there was an error.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_GetPeerAddress,TCPsocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_GetPeerAddress%2CTCPsocket"><span class="Identifier">tCP_GetPeerAddress</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_GetPeerAddress"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Get the IP address of the remote system associated with the socket.
|
|
If the socket is a server socket, this function returns NULL.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_Send,TCPsocket,pointer,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_Send%2CTCPsocket%2Cpointer%2Ccint"><span class="Identifier">tCP_Send</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">len</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_Send"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Send 'len' bytes of 'data' over the non-server socket 'sock'
|
|
This function returns the actual amount of data sent. If the return value
|
|
is less than the amount of data sent, then either the remote connection was
|
|
closed, or an unknown socket error occurred.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_Recv,TCPsocket,pointer,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_Recv%2CTCPsocket%2Cpointer%2Ccint"><span class="Identifier">tCP_Recv</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">;</span> <span class="Identifier">maxlen</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_Recv"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
|
|
and store them in the buffer pointed to by 'data'.
|
|
This function returns the actual amount of data received. If the return
|
|
value is less than or equal to zero, then either the remote connection was
|
|
closed, or an unknown socket error occurred.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="tCP_Close,TCPsocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tCP_Close%2CTCPsocket"><span class="Identifier">tCP_Close</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#TCPsocket"><span class="Identifier">TCPsocket</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_TCP_Close"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Close a TCP network socket</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="allocPacket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allocPacket%2Ccint"><span class="Identifier">allocPacket</span></a><span class="Other">(</span><span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_AllocPacket"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Allocate/resize/free a single UDP packet 'size' bytes long.
|
|
The new packet is returned, or NULL if the function ran out of memory.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="resizePacket,ptr.UDPpacket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#resizePacket%2Cptr.UDPpacket%2Ccint"><span class="Identifier">resizePacket</span></a><span class="Other">(</span><span class="Identifier">packet</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">;</span> <span class="Identifier">newsize</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_ResizePacket"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="freePacket,ptr.UDPpacket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#freePacket%2Cptr.UDPpacket"><span class="Identifier">freePacket</span></a><span class="Other">(</span><span class="Identifier">packet</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_FreePacket"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="allocPacketV,cint,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allocPacketV%2Ccint%2Ccint"><span class="Identifier">allocPacketV</span></a><span class="Other">(</span><span class="Identifier">howmany</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_AllocPacketV"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
|
|
each 'size' bytes long.
|
|
A pointer to the first packet in the array is returned, or NULL if the
|
|
function ran out of memory.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="freePacketV,ptr.ptr.UDPpacket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#freePacketV%2Cptr.ptr.UDPpacket"><span class="Identifier">freePacketV</span></a><span class="Other">(</span><span class="Identifier">packetV</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_FreePacketV"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Open,Uint16"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Open%2CUint16"><span class="Identifier">uDP_Open</span></a><span class="Other">(</span><span class="Identifier">port</span><span class="Other">:</span> <a href="sdl2.html#Uint16"><span class="Identifier">Uint16</span></a><span class="Other">)</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Open"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Open a UDP network socket
|
|
If 'port' is non-zero, the UDP socket is bound to a local port.
|
|
The 'port' should be given in native byte order, but is used
|
|
internally in network (big endian) byte order, in addresses, etc.
|
|
This allows other systems to send to this socket via a known port.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_SetPacketLoss,UDPsocket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_SetPacketLoss%2CUDPsocket%2Ccint"><span class="Identifier">uDP_SetPacketLoss</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">percent</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_SetPacketLoss"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Set the percentage of simulated packet loss for packets sent on the socket.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Bind,UDPsocket,cint,ptr.IPaddress"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Bind%2CUDPsocket%2Ccint%2Cptr.IPaddress"><span class="Identifier">uDP_Bind</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">channel</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Bind"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Bind the address 'address' to the requested channel on the UDP socket.
|
|
If the channel is -1, then the first unbound channel that has not yet
|
|
been bound to the maximum number of addresses will be bound with
|
|
the given address as it's primary address.
|
|
If the channel is already bound, this new address will be added to the
|
|
list of valid source addresses for packets arriving on the channel.
|
|
If the channel is not already bound, then the address becomes the primary
|
|
address, to which all outbound packets on the channel are sent.
|
|
This function returns the channel which was bound, or -1 on error.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Unbind,UDPsocket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Unbind%2CUDPsocket%2Ccint"><span class="Identifier">uDP_Unbind</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">channel</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Unbind"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Unbind all addresses from the given channel</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_GetPeerAddress,UDPsocket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_GetPeerAddress%2CUDPsocket%2Ccint"><span class="Identifier">uDP_GetPeerAddress</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">channel</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#IPaddress"><span class="Identifier">IPaddress</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_GetPeerAddress"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Get the primary IP address of the remote system associated with the
|
|
socket and channel. If the channel is -1, then the primary IP port
|
|
of the UDP socket is returned -- this is only meaningful for sockets
|
|
opened with a specific port.
|
|
If the channel is not bound and not -1, this function returns NULL.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_SendV,UDPsocket,ptr.ptr.UDPpacket,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_SendV%2CUDPsocket%2Cptr.ptr.UDPpacket%2Ccint"><span class="Identifier">uDP_SendV</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">packets</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">;</span> <span class="Identifier">npackets</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_SendV"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Send a vector of packets to the the channels specified within the packet.
|
|
If the channel specified in the packet is -1, the packet will be sent to
|
|
the address in the 'src' member of the packet.
|
|
Each packet will be updated with the status of the packet after it has
|
|
been sent, -1 if the packet send failed.
|
|
This function returns the number of packets sent.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Send,UDPsocket,cint,ptr.UDPpacket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Send%2CUDPsocket%2Ccint%2Cptr.UDPpacket"><span class="Identifier">uDP_Send</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">channel</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">packet</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Send"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Send a single packet to the specified channel.
|
|
If the channel specified in the packet is -1, the packet will be sent to
|
|
the address in the 'src' member of the packet.
|
|
The packet will be updated with the status of the packet after it has
|
|
been sent.
|
|
This function returns 1 if the packet was sent, or 0 on error.
|
|
NOTE:
|
|
The maximum size of the packet is limited by the MTU (Maximum Transfer Unit)
|
|
of the transport medium. It can be as low as 250 bytes for some PPP links,
|
|
and as high as 1500 bytes for ethernet.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_RecvV,UDPsocket,ptr.ptr.UDPpacket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_RecvV%2CUDPsocket%2Cptr.ptr.UDPpacket"><span class="Identifier">uDP_RecvV</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">packets</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_RecvV"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Receive a vector of pending packets from the UDP socket.
|
|
The returned packets contain the source address and the channel they arrived
|
|
on. If they did not arrive on a bound channel, the the channel will be set
|
|
to -1.
|
|
The channels are checked in highest to lowest order, so if an address is
|
|
bound to multiple channels, the highest channel with the source address
|
|
bound will be returned.
|
|
This function returns the number of packets read from the network, or -1
|
|
on error. This function does not block, so can return 0 packets pending.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Recv,UDPsocket,ptr.UDPpacket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Recv%2CUDPsocket%2Cptr.UDPpacket"><span class="Identifier">uDP_Recv</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">;</span> <span class="Identifier">packet</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="sdl2_net.html#UDPpacket"><span class="Identifier">UDPpacket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Recv"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Receive a single packet from the UDP socket.
|
|
The returned packet contains the source address and the channel it arrived
|
|
on. If it did not arrive on a bound channel, the the channel will be set
|
|
to -1.
|
|
The channels are checked in highest to lowest order, so if an address is
|
|
bound to multiple channels, the highest channel with the source address
|
|
bound will be returned.
|
|
This function returns the number of packets read from the network, or -1
|
|
on error. This function does not block, so can return 0 packets pending.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="uDP_Close,UDPsocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#uDP_Close%2CUDPsocket"><span class="Identifier">uDP_Close</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#UDPsocket"><span class="Identifier">UDPsocket</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_UDP_Close"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Close a UDP network socket</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="allocSocketSet,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#allocSocketSet%2Ccint"><span class="Identifier">allocSocketSet</span></a><span class="Other">(</span><span class="Identifier">maxsockets</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_AllocSocketSet"</span><span class="Other">,</span>
|
|
<span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Allocate a socket set for use with SDLNet_CheckSockets()
|
|
This returns a socket set for up to 'maxsockets' sockets, or NULL if
|
|
the function ran out of memory.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="addSocket,SocketSet,GenericSocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#addSocket%2CSocketSet%2CGenericSocket"><span class="Identifier">addSocket</span></a><span class="Other">(</span><span class="Identifier">set</span><span class="Other">:</span> <a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a><span class="Other">;</span> <span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#GenericSocket"><span class="Identifier">GenericSocket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_AddSocket"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Add a socket to a set of sockets to be checked for available data</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="delSocket,SocketSet,GenericSocket"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#delSocket%2CSocketSet%2CGenericSocket"><span class="Identifier">delSocket</span></a><span class="Other">(</span><span class="Identifier">set</span><span class="Other">:</span> <a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a><span class="Other">;</span> <span class="Identifier">sock</span><span class="Other">:</span> <a href="sdl2_net.html#GenericSocket"><span class="Identifier">GenericSocket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_DelSocket"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Remove a socket from a set of sockets to be checked for available data</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="checkSockets,SocketSet,Uint32"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#checkSockets%2CSocketSet%2CUint32"><span class="Identifier">checkSockets</span></a><span class="Other">(</span><span class="Identifier">set</span><span class="Other">:</span> <a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a><span class="Other">;</span> <span class="Identifier">timeout</span><span class="Other">:</span> <a href="sdl2.html#Uint32"><span class="Identifier">Uint32</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma">
|
|
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_CheckSockets"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>This function checks to see if data is available for reading on the
|
|
given set of sockets. If 'timeout' is 0, it performs a quick poll,
|
|
otherwise the function returns when either data is available for
|
|
reading, or the timeout in milliseconds has elapsed, which ever occurs
|
|
first. This function returns the number of sockets ready for reading,
|
|
or -1 if there was an error with the select() system call.</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="freeSocketSet,SocketSet"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#freeSocketSet%2CSocketSet"><span class="Identifier">freeSocketSet</span></a><span class="Other">(</span><span class="Identifier">set</span><span class="Other">:</span> <a href="sdl2_net.html#SocketSet"><span class="Identifier">SocketSet</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_FreeSocketSet"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>Free a set of sockets allocated by SDL_NetAllocSocketSet()</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="setError,cstring"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#setError%2Ccstring"><span class="Identifier">setError</span></a><span class="Other">(</span><span class="Identifier">fmt</span><span class="Other">:</span> <span class="Identifier">cstring</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_SetError"</span><span class="Other">,</span> <span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">varargs</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
<pre>
|
|
Error reporting functions</pre>
|
|
|
|
|
|
</dd>
|
|
<a id="getError"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getError"><span class="Identifier">getError</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cstring</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_GetError"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="getLastError"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getLastError"><span class="Identifier">getLastError</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">cint</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_GetLastError"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
<a id="setLastError,cint"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#setLastError%2Ccint"><span class="Identifier">setLastError</span></a><span class="Other">(</span><span class="Identifier">err</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">"SDLNet_SetLastError"</span><span class="Other">,</span> <span class="Identifier">cdecl</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small style="color: var(--hint);">Made with Nim. Generated: 2020-04-26 21:10:29 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|