简体   繁体   中英

Can I use web browser and javascript to implement client socket program

Can I implement a BSD client socket program using web browser and javascript that would communicate with an embedded web server BSD socket program running in a microcontroller programmed in C to transfer large files? If so, should I be looking at socket.io or where do I start (I'm a beginner javascript programmer)? And will the programming be as straightforward as BSD client server socket program interaction in C?

Thanks. Jay

Well Well That's lots of questions.

  • First Browser's sandbox model doesn't allow to do so
  • Coming to socket programming, you can use flash sockets (Chances are high this will be deprecated shortly)
  • You can use chrome extension sockets to connect to tcp sockets, but again this will be deprecated shortly.
  • socket.io is javascript library for websockets which is duplex communication over http.

So I would like to sum it up as of now you can't connect to tcp sockets through javascript in browser but yes you can do so using nodejs which doesn't run in browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM