xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

INetDGram()

Creates an unbound datagram oriented socket.

Syntax

INetDGram( [<lBroadcast>] ) --> pSocket

Arguments

<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. Note that this requires certain user privileges on most operating systems.

Return

The functions returns a pointer to an unbound datagram socket.

Description

Function INetDGram() creates an unbound socket configured for the User Datagram Protocol (UDP). The socket is able to send and eventually receive data. Since the socket is not bound, a program cannot retrieve the address at which the socket appears to be, but a second socket receiving a message sent from <pSocket> is able to reply correctly with a datagram that can be read from an unbound socket.

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

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:INetDGramBind(), 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