-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server #12
Comments
HI @amiiigh. I'll be on it. I'll document on how to use this library. In the meanwhile, this is how you use the library for the purposes of using it like a server. var rudp = require('rudp');
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
// Where `localPort` is the port to connect to.
socket.bind(localPort);
var server = new rudp.Server(socket);
server.on('connection', socket => {
socket.on('data', data => {
console.log(data.toString('utf8'));
});
socket.write('Hello, World!');
}); Essentially, it is used like Node.js' |
Hey @shovon I'm just a bit confused now. Also can the server reply to the client by just using that connection, with something like connection.send() or connection.write() ? My last question is about net.socket.end() function in net library in node. Is there anything equivalent to that in this library? |
You are right. It is not a stream. I will need to implement the stream functionality.
Yes. With
This library is a wrapper for the |
Hey, @shovon it's me again :D Do I need to modify any other part of the code? for the _write function it's just going to call the send function, right? Also, do you have any plan to make your library for es6? I can help if you like to do that. |
I am more than thankful that you want to look into helping me turn So here are the steps that we want to do in order to achieve the above.
Stretch goal: maintain TypeScript types. |
@amiiigh let me know if you are still interested in doing so. |
Please pull from master. I've made some changes, recently. |
yeah man, let's do it!
|
Hey,
Would you please also provide an example for the Server part?
How can I get the data after the server received any? shouldn't be a listener on connection and emit the data after?
The text was updated successfully, but these errors were encountered: