That does not work. The tcpsocket API only let's you create a connection to
a specific IP address.

To listen for incoming connections which can be initiated by anyone, you
need to use the tcpserver API which is currently in progress and will
hopefully be shipping in v1.2

/ Jonas
On Jul 10, 2013 2:42 PM, <[email protected]> wrote:

>
> I'd like to write a Firefox OS app that allows me to initiate various
> activities -- sending an SMS, for example -- from a remote device like a
> desktop computer.
>
> It would seem that navigator.mozTCPSocket might allow me to listen for
> incoming requests on a given port and to react to them.
>
> I'd like to understand first if I'm understanding the capabilities of this
> API correct.
>
> For example, if I run an app with code like this on my device:
>
> var socket = navigator.mozTCPSocket.open('localhost', 8080);
>
> socket.ondata = function (event) {
>   if (typeof event.data === 'string') {
>     console.log('Get a string: ' + event.data);
>   } else {
>     console.log('Get a Uint8Array');
>   }
> }
>
> Should I then expect to be able to do something like:
>
> echo "Hello" | netcat [device IP] 8080
>
> and see "Hello" in the console log of the device?
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to