updated udpType handling fixes #49

This commit is contained in:
Brandon Nozaki Miller 2016-01-04 01:22:37 -08:00
parent 57a813124e
commit a8ea63eca6
4 changed files with 10 additions and 13 deletions

View file

@ -1,3 +0,0 @@
{
"sbruchmann.staticpreview.basepath": "/home/bmiller/git/node-ipc/"
}

View file

@ -355,8 +355,8 @@ Used to create TCP, TLS or UDP Socket Server to which Clients can bind or other
| variable | required | definition | | variable | required | definition |
|----------|----------|------------| |----------|----------|------------|
| host | optional | If not specified this defaults to the first address in os.networkInterfaces(). For TCP, TLS & UDP servers this is most likely going to be 127.0.0.1 or ::1 | | host | optional | If not specified this defaults to the first address in os.networkInterfaces(). For TCP, TLS & UDP servers this is most likely going to be 127.0.0.1 or ::1 |
| port | optional | The port on wunich the TCP, UDP, or TLS Socket server will be bound, this defaults to 8000 if not specified | | port | optional | The port on which the TCP, UDP, or TLS Socket server will be bound, this defaults to 8000 if not specified |
| UDPType | optional | If set this will create the server as a UDP socket. 'udp4' or 'udp6' are valid values. This defaults to not being set. | UDPType | optional | If set this will create the server as a UDP socket. 'udp4' or 'udp6' are valid values. This defaults to not being set. When using udp6 make sure to specify a valid IPv6 host, like ` ::1 ` |
| callback | optional | Function to be called when the server is created | | callback | optional | Function to be called when the server is created |
***examples*** arguments can be ommitted solong as they are still in order. ***examples*** arguments can be ommitted solong as they are still in order.

View file

@ -1,22 +1,22 @@
var ipc=require('../../../node-ipc'); var ipc=require('../../../node-ipc');
/***************************************\ /***************************************\
* *
* UDP Client is really a UDP server * UDP Client is really a UDP server
* *
* Dedicated UDP sockets on the same * Dedicated UDP sockets on the same
* machine can not be bound to in the * machine can not be bound to in the
* traditional client/server method * traditional client/server method
* *
* Every UDP socket is it's own UDP server * Every UDP socket is it's own UDP server
* And so must have a unique port on its * And so must have a unique port on its
* machine, unlike TCP or Unix Sockts * machine, unlike TCP or Unix Sockts
* which can share on the same machine. * which can share on the same machine.
* *
* Since there is no open client server * Since there is no open client server
* relationship, you should start world * relationship, you should start world
* first and then hello. * first and then hello.
* *
***************************************/ ***************************************/
ipc.config.id = 'world'; ipc.config.id = 'world';
@ -45,4 +45,4 @@ ipc.serveNet(
ipc.server.start(); ipc.server.start();

View file

@ -295,7 +295,7 @@ function init(path,config,log,port){
return; return;
} }
if(!server.udp4 && !server.udp4){ if(!server.udp4 && !server.udp6){
server.log('starting server as'.debug, (server.config.tls?'TLS':'TCP').variable); server.log('starting server as'.debug, (server.config.tls?'TLS':'TCP').variable);
server.server.listen( server.server.listen(
server.port, server.port,