Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send udp to udp node.js server?

I'm very new to this so I really don't know what I'm doing, but I've setup a node.js udp server. I want to send a packet to it from the client (being from a website), but I don't know how to do that in javascript/ or if it's even possible. I'm not looking on how to send a packet from a node.js client to server, but rather how to write a website to send a packet to a node.js udp server. Not sure if that made sense, but thanks for the help!

like image 369
Derek Avatar asked Sep 02 '25 01:09

Derek


1 Answers

You may be interested in this tutorial:

http://fzysqr.com/2011/02/28/nodechat-js-using-node-js-backbone-js-socket-io-and-redis-to-make-a-real-time-chat-app/

It goes through how to create a chat application in node.js in very fine detail, he even shows how to use Socket.io (a browser js library) to utilize web sockets for realtime, low latency responses.

And as Phihag hinted at, UDP isn't good for this sort of application because UDP does not guarantee your packet will get to its destination. You definitely want to use TCP Sockets in this case.

More reading:

  • http://en.wikipedia.org/wiki/Transmission_Control_Protocol
  • http://en.wikipedia.org/wiki/User_Datagram_Protocol
like image 77
Jonathan Dumaine Avatar answered Sep 04 '25 15:09

Jonathan Dumaine