WebUdpClose Function

Action

Closes an UDP handle, which has been created by a call to the WebUdpCreate function. Every handle created with the WebUdpCreate function must be closed by using this function in order to free all allocated system resources.

Include file

WebAPI.bdh

Syntax

WebUdpClose( inout hUdp : number ): boolean;

Return value

  • true if the handle has been closed successfully

  • false otherwise

Parameter Description
hUdp Valid UDP handle, that has been created by WebUdpCreate.

Example

dcltrans
  transaction TWeb
    var
      nUdp  : number;
      sBuf  : string;
      sIp   : string;
      nPort : number;
  begin
    WebUdpCreate(nUdp);
    WebUdpSendTo(nUdp, "10.5.2.103", 9998, "1234567890");
    WebUdpGetBindInfo(nUdp, sIp, nPort);
    print("bound to "+sIp+" : "+string(nPort));
    WebUdpRecvFrom(nUdp, sBuf, STRING_COMPLETE, sIp, nPort);
    print("got data from "+sIp+" : "+string(nPort));
    WebUdpClose(nUdp);
    print(sBuf);
  end TWeb;