package main

import (
	"flag"
	"github.com/goerlang/node"
	"log"
)

var enableNode bool
var nodeName string
var nodeCookie string
var nodePort int

func init() {
	flag.BoolVar(&enableNode, "node", false, "start erlang node")
	flag.StringVar(&nodeName, "node-name", "", "name of erlang node")
	flag.StringVar(&nodeCookie, "node-cookie", "", "cookie of erlang node")
	flag.IntVar(&nodePort, "node-port", 5858, "port of erlang node")
}

func nodeEnabled() bool {
	return enableNode
}

func runNode() (enode *node.Node) {
	enode = node.NewNode(nodeName, nodeCookie)
	err := enode.Publish(nodePort)
	if err != nil {
		log.Printf("Cannot publish: %s", err)
		enode = nil
	}
	eSrv := new(eclusSrv)
	enode.Spawn(eSrv)
	return
}

package main

import (
	"flag"
	"github.com/goerlang/node"
	"log"
)

var enableNode bool
var nodeName string
var nodeCookie string

func init() {
	flag.BoolVar(&enableNode, "node", false, "start erlang node")
	flag.StringVar(&nodeName, "node-name", "", "name of erlang node")
	flag.StringVar(&nodeCookie, "node-cookie", "", "cookie of erlang node")
}

func nodeEnabled() bool {
	return enableNode
}

func runNode() (enode *node.Node) {
	enode = node.NewNode(nodeName, nodeCookie)
	err := enode.Publish(5858)
	if err != nil {
		log.Printf("Cannot publish: %s", err)
		enode = nil
	}
	eSrv := new(eclusSrv)
	enode.Spawn(eSrv)
	return
}

--- 
+++ 
@@ -9,11 +9,13 @@
 var enableNode bool
 var nodeName string
 var nodeCookie string
+var nodePort int
 
 func init() {
 	flag.BoolVar(&enableNode, "node", false, "start erlang node")
 	flag.StringVar(&nodeName, "node-name", "", "name of erlang node")
 	flag.StringVar(&nodeCookie, "node-cookie", "", "cookie of erlang node")
+	flag.IntVar(&nodePort, "node-port", 5858, "port of erlang node")
 }
 
 func nodeEnabled() bool {
@@ -22,7 +24,7 @@
 
 func runNode() (enode *node.Node) {
 	enode = node.NewNode(nodeName, nodeCookie)
-	err := enode.Publish(5858)
+	err := enode.Publish(nodePort)
 	if err != nil {
 		log.Printf("Cannot publish: %s", err)
 		enode = nil
Add flag `-node-port` to specify TCP-port for distribution protocol
