<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - UdpSocket.Bind
 (gb.net)</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help+en"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../udpsocket+en">Up</a>&nbsp;
<a href="_read+en">Previous</a>&nbsp;
<a href="peek+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
UdpSocket.Bind
 (gb.net)</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">SUB</font> <b>Bind</b> <font color="blue">(</font> <u>Port</u> <font color="blue">AS</font> <font color="#0080FF">Integer</font> <font color="blue">)</font></pre>
Binds a socket to a port, so the object can start sending and receiving data.
<p>
<u>Port</u> value must be a number between 0 and 65535:
<ul>
<li>0: binds socket to any available port in the system. This is the usual operative for UDP clients.
<li>1 -> 65535: binds socket to that port, if possible. This is the usual operative for UDP servers.
<p>
</ul>

This function can be used when the <a href="status+en">Status</a> property is zero (inactive) or lesser than zero. Otherwise, an error will raise.

</div>
</body>
</html>

