# Namespace hcap.socket

hcap.socket

- Defined in: hcap-1.24.6.5901.js

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| hcap.socket

## Method Summary

## Namespace Detail

hcap.socket

## Method Detail

- <static> hcap.socket.closeTcpDaemon(param)
  Close TCP socket daemon.

      hcap.socket.closeTcpDaemon({
           "port" : 9312,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.port [Required] - port number of TCP connection to close.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.10.1
  See:
    hcap.socket.openTcpDaemon()
    {Event} tcp_data_received
- <static> hcap.socket.closeUdpDaemon(param)
  Close UDP socket daemon.

      hcap.socket.closeUdpDaemon({
           "port" : 9311,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.port [Required] - port number of UDP connection to close.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.6.0
  See:
    hcap.socket.openUdpDaemon()
    {Event} udp_data_received
    hcap.socket.sendUdpData()
- <static> hcap.socket.openTcpDaemon(param)
  Open TCP socket daemon.
  To try opening TCP socket daemon with a port that has already been opened will be failed. In this case, please close the previous daemon and try it again.
  And if the application is unloaded, all opened TCP socket daemons will be destroyed.

      hcap.socket.openTcpDaemon({
           "port" : 9312,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.port [Required] - socket port number to open its TCP socket daemon.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.10.1
  See:
    hcap.socket.closeTcpDaemon()
    {Event} tcp_data_received
- <static> hcap.socket.openUdpDaemon(param)
  Open UDP socket daemon.
  To try opening UDP socket daemon with a port that has already been opened will be failed. In this case, please close the previous daemon and try it again.
  And if the application is unloaded, all opened UDP socket daemons will be destroyed.

      hcap.socket.openUdpDaemon({
           "port" : 9311,
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {Number} param.port [Required] - socket port number to open its UDP socket daemon.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.6.0
  See:
    hcap.socket.closeUdpDaemon()
    {Event} udp_data_received
    hcap.socket.sendUdpData()
- <static> hcap.socket.sendUdpData(param)
  Send UDP packet data to remote UDP server.

      hcap.socket.sendUdpData({
           "ip" : "192.168.123.56",
           "port" : 7222,
           "udpData" : "UDP packet data to send",
           "onSuccess" : function() {
               console.log("onSuccess");
           },
           "onFailure" : function(f) {
               console.log("onFailure : errorMessage = " + f.errorMessage);
           }
      });

  Parameters:
  {Object} param
    - {String} param.ip [Required] - IP address of remote UDP server to send UDP packet data.
    - {Number} param.port [Required] - port number of remote UDP server.
    - {String} param.udpData [Required] - UDP packet data.
    - {Function} param.onSuccess [Optional] - success callback function.

            param.onSuccess = function() {
                // No Parameter.
            }

    - {Function} param.onFailure [Optional] - failure callback function.

            param.onFailure = function (param) {
                // {String} param.errorMessage - in case of failure, this message provides the details.
            }

  Since:
    1.10.1
  See:
    hcap.socket.openUdpDaemon()
    hcap.socket.closeUdpDaemon()
    {Event} udp_data_received