D0301
HTML Application SDK  A1.8
Classes | Public Member Functions | List of all members
SocketManager Interface Reference

import"SocketManagerPlugin.idl";

Classes

interface  payloadReceivedEvent
 

Public Member Functions

void addEventListener ([in] String event_name, [in] EventListener listener)
 
Boolean closeUdpSocket ([in] Integer port)
 
Boolean openUdpSocket ([in] Integer port)
 
void removeEventListener ([in] String event_name, [in] EventListener listener)
 
void removeEventListener ([in] String event_name)
 
Boolean sendUdpData ([in] String ip_address, [in] Integer port, [in] Integer[] payload)
 

Detailed Description

This is a class which implements global SocketManager object.

Member Function Documentation

void SocketManager.addEventListener ( [in] String  event_name,
[in] EventListener  listener 
)

Adds DOM2 event listener for specified event.

Possible values are: event_name: "payloadReceivedEvent", listener: function that has arguments similar to the payloadReceivedEvent interface properties.

Parameters
event_nameName of the event.
listenerjavascript function that has arguments like the properties listed in the listener's interface.
Boolean SocketManager.closeUdpSocket ( [in] Integer  port)

This function closes UDP socket for the given port.

var result4 = SocketManager.closeUdpSocket(2350);
Parameters
portPort to be closed
Returns
true if closing UDP socket is successful, false otherwise
Boolean SocketManager.openUdpSocket ( [in] Integer  port)

This function opens UDP socket.

var result0 = SocketManager.openUdpSocket(2350);
Parameters
portPort to be opened
Returns
true if opening UDP socket is successful, false otherwise
void SocketManager.removeEventListener ( [in] String  event_name,
[in] EventListener  listener 
)

Removes single DOM2 event listener for specified event

Possible values are: event_name: "payloadReceivedEvent", listener: function that has arguments similar to the payloadReceivedEvent interface properties.

Parameters
event_nameName of the event
listenernamed javascript function that has arguments like the properties listed in the listener's interface.
void SocketManager.removeEventListener ( [in] String  event_name)

Removes all DOM2 event listeners for specified event

Parameters
event_nameName of the event
See also
removeEventListener([in] String event_name, [in] EventListener listener);
Boolean SocketManager.sendUdpData ( [in] String  ip_address,
[in] Integer  port,
[in] Integer[]  payload 
)

This function sends UDP data to a UDP socket. It requires the socket to be opened explicitly by calling openUdpSocket() for the port before calling sendUdpData(). It should be noted that the maximum payload length is 128 kb.

var result7 = SocketManager.sendUdpData("192.168.3.45", 2350, [83,97,109,112,108,101]);
Parameters
ip_addressIP address to which the payload will be sent.
portPort to which the payload will be sent.
payloadData to be sent.
Returns
true if sending data is successful, false otherwise

The documentation for this interface was generated from the following file: