Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

TCPSocket.listen()

This API is available on Firefox OS for privileged or certified applications only.

Summary

The listen method is used to listen on a given port on the device.

Syntax

var instanceOfTCPServerSocket = navigator.mozTCPSocket.listen(port[, options[, backlog]]);

Parameters

port
A number representing the port the server socket is listening on. Pass -1 to indicate no preference, and a port will be selected automatically.
options Optional

An object specifying the details of the socket. This object expects the following property:

  • binaryType: a string with the value string (default) or arraybuffer. If the latter is used, the argument for the send() method must be an ArrayBuffer and the data received from the server will be available as an ArrayBuffer. Otherwise, a string is expected.
backlog Optional
A number representing the maximum length the queue of pending connections may grow to. This parameter may be silently limited by the operating system. Pass -1 to use the default value.

Returns

It returns a new TCPServerSocket object listening on the provided port.

Specification

Not part of any specification yet; however, this API is discussed at W3C as part of the System Applications Working Group under the Raw Sockets proposal.

See also

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, teoli, kscarfone, Jeremie
 Last updated by: chrisdavidmills,