Giter Site home page Giter Site logo

Comments (2)

goarchit avatar goarchit commented on September 28, 2024

Oddly much further in my development project, and just had this issue come up again. My code seems to be working despite it, which is a bit puzzling.

In this case, its occuring when I make an RPC call to the public IP from the the box that is serving the port.
e.g.:

2017/04/10 21:51:47 gorpc.Server: [66.128.118.34:56796]->[:1958]. Error when reading handshake from client: [EOF]

Where 66.128.118.34 is the public IP address of the machine itself. Will update when I figure this out.

from gorpc.

goarchit avatar goarchit commented on September 28, 2024

Hmmm, out of ideas. Fortunately the code snippets are fairly short.
Calling code:

37         // Active seed node already found in util.DNSsed() and stored in util.MyDNSServerIP
38
39         c := gorpc.NewTCPClient(util.MyDNSServerIP)
40         c.Start()
41         defer c.Stop()
42
43         d := gorpc.NewDispatcher()
44         d.AddFunc("PeerAdd", func(pi *PeerInfo) string {return PeerAdd(pi)})
45         d.AddFunc("PeerListAll", func() string {return PeerListAll()})
46
47         dc := d.NewFuncClient(c)
48         // Add yourself to your seed node, the seed will tell everyone else
49         _, err := dc.Call("PeerAdd", iAm)
50         if err != nil {
51                 log.Critical("Accounce to seed", util.MyDNSServerIP, "failed:", err)
52         }
53         // Now go ask for all known nodes
54         plstr, err := dc.Call("PeerListAll",nil)
55         if err != nil {
56                 log.Critical("Attempt to get PeerList from seed", util.MyDNSServerIP, "failed:", err)
57         }

Receiving code:

17 var extRPC = gorpc.NewDispatcher()
18 var intCmd *gorpc.Server
19 var extCmd *gorpc.Server
20
21 func Run(c chan bool) {
22
23         // Start common services
24         go server.Wallet(walletCmd)
25         go server.DB(dbCmd)
26
27         // External RPC service first
28         // Start by registering fucntions and types
29         extRPC.AddFunc("Ping", func() string { return "ePong!" })
30         extRPC.AddFunc("PeerAdd", func(pi *PeerInfo) string { return PeerAdd(pi) })
31         extRPC.AddFunc("PeerListAll", func() string { return PeerListAll() })
32
33         // Then launch the server
34         serverIP := ":" + strconv.Itoa(config.Archit.PortBase) // Listen on all interfaces
35         log.Info("Farmer External RPC Server using server address", serverIP)
36         extCmd = gorpc.NewTCPServer(serverIP, extRPC.NewHandlerFunc())
37         err := extCmd.Start()
38         if err != nil {
39                 log.Critical("Farmer External RPC service failed to start: ", err)
40         }
41
42         defer extCmd.Stop()

And the handling function definitions themselves:

43 func PeerAdd(pi *PeerInfo) string {
132 func PeerListAll() string {

Which generate the above error when running, but otherwise appear to be working just fine.

Any suggestions would be greatly appreciated.

from gorpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.