0

Possible Duplicate:
Will HTML5 allow web apps to make peer-to-peer HTTP connections?

I want to make a Internet connection from one device to another how to do the coding of it using html5 and javascript

Community
  • 1
  • 1
deve1
  • 195
  • 1
  • 3
  • 14
  • 1. what have you tried? 2. what do you mean with an internet connection between two devices? – red-X Jul 02 '12 at 10:42
  • i m trying to use Web Socket. is it the right way to do it?. by internet connection between two device i mean if one device enable the hotspot connection of it then another device can use the connection of first device by providing authentication – deve1 Jul 02 '12 at 10:47
  • @Quentin it may well be a duplicate, but the accepted answer on that question is wrong. – Alnitak Jul 02 '12 at 10:48
  • @infodeve1 no, that's completely outside the realms of what you can do with Javascript. If you want the first device to act as a _router_ for the second, that first device must provide NAT and native IP services to the second. – Alnitak Jul 02 '12 at 10:49
  • @Alnitak — So provide a better answer on that question rather than leaving the bad information there unchallenged. – Quentin Jul 02 '12 at 10:50
  • @Quentin someone already did - http://stackoverflow.com/a/1032171/6782 - but it only has two upvotes – Alnitak Jul 02 '12 at 10:51
  • how to provide the NAT and native IP services? can you please explain – deve1 Jul 02 '12 at 10:55
  • @infodeve1 that's why I'm saying - you can't. Doing that requires operating system level features. – Alnitak Jul 02 '12 at 11:10
  • is it possible to do it in Android in place of html5? – deve1 Jul 02 '12 at 11:13

1 Answers1

1

You can't - at least not directly.

Not only does JS not include any suitable APIs, but things like NAT devices tend to get in the way of device-to-device connections.

Possible work arounds include having both devices make a connection to a central server, perhaps using WebSockets.

Alnitak
  • 334,560
  • 70
  • 407
  • 495