xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

INetDGramBind()

Creates a bound datagram oriented socket.

Syntax

INetDGramBind( <nPort>      , ;
              [<cIPAddress>], ;
              [<lBroadcast>], ;
              [<cMulticast>]  ) --> pSocket

Arguments

<nPort>
This is the numeric port number on the local computer to bind the datagram socket to.
<cIPAddress>
If specified, this is a character string holding the IP address of a server in dotted notation (e.g. "192.168.1.145").
<lBroadcast>
This parameter defaults to .F. (false). When set to .T. (true), the function creates a broadcast capable socket, able to send and receive broadcast messages.
<cMulticast>
If specified, this is a character string holding the IP multicast address of a group in dotted notation.

Return

The functions returns a pointer to a bound datagram socket.

Description

Function INetDGramBind() creates a bound socket configured for the User Datagram Protocol (UDP). The socket is able to send and receive data.

If <lBroadcast> is set to .T. (true) a broadcast capable socket is returned. However, this may require certain user privileges.

A broadcast socket can be restricted to a group by specifiying a multicast IP address.

If the socket cannot be created, a socket error is set that can be analyzed with function INetErrorCode().

Note:  refer to function INetDGramSend() for an example of datagram exchange between two processes.

Info

See also:INetDGram(), INetDGramRecv(), INetDGramSend()
Category: Datagram functions , Sockets functions , xHarbour extensions
Source:vm\INet.c
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe