예제 #1
0
파일: connect.go 프로젝트: petar/GoNeedle
func main() {
	//needle.InstallCtrlCPanic()
	flag.Parse()
	fmt.Fprintf(os.Stderr,
		"Starting Needle Connect, 2010 (C) Petar Maymounkov, "+
			"http://github.com/petar/GoNeedle\n")

	peer, err := needle.MakePeer(*flagLocalId, *flagBind, *flagServer)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Problem starting peer: %s\n", err)
		os.Exit(1)
	}

	fmt.Fprintf(os.Stderr, "Dialing %s, using server %s\n", *flagRemoteId, *flagServer)
	peer.Dial(*flagRemoteId)

	<-make(chan int)
}
예제 #2
0
파일: listen.go 프로젝트: petar/GoNeedle
func main() {
	//needle.InstallCtrlCPanic()
	flag.Parse()
	fmt.Fprintf(os.Stderr,
		"Starting Needle Listen, 2010 (C) Petar Maymounkov, "+
			"http://github.com/petar/GoNeedle\n")

	_, err := needle.MakePeer(*flagLocalId, *flagBind, *flagServer)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Problem starting peer: %s\n", err)
		os.Exit(1)
	}

	fmt.Fprintf(os.Stderr, "Listening for connections on %s, using server %s\n",
		*flagBind, *flagServer)

	<-make(chan int)
}