butter-network / butter

Butter is a networking stack and framework for building peer-to-peer applications (dapps).
https://a-shine.github.io/butter/
GNU General Public License v3.0
3 stars 2 forks source link

Error listening #5

Open lonnietc opened 1 year ago

lonnietc commented 1 year ago

Hello,

I just tried to compile (Go v1.19.3) on my Windows 10 (x64) system and the compile went fine for the examples, but when I try to start them up, I get a TCP bind error:

run> .\persist.exe
Error listening: listen tcp 169.254.222.0:0: bind: The requested address is not valid in its context.

This happens on all of the examples.

Any ideas how to fix this? Thanks

lonnietc commented 1 year ago

Update, in my research on this it seems that Butter did not bind to the correct IP address as that is not one listed on my machine and it is suggested to Bind: 0.0.0.0 instead.

Not sure how to fix this, but all of the butter related applications that you have available under the butter-network:

https://github.com/butter-network

All produce the same error on this test machine which works fine with other network software. Thanks

a-shine commented 1 year ago

Hi @lonnietc,

I was happy to hear you're messing around with Butter!

I haven't been able to re-produce your error on my machine (I'm on Linux and haven't ever really tried running Butter on Windows). I have, however, changed the strategy for obtaining the host machines IP address so if you pull the latest commit and rebuild it may fix you issue.

Keep me posted on what happen :)

Warm regards, Alex

lonnietc commented 1 year ago

Hello Alex, (@a-shine added this since I was not sure if it gets sent to you, sorry for multiple updates)

I truly appreciate you getting back to me on this as I am researching a viable, efficient, and cutting-edge way to develop a type of mountable P2P filesystem to handle a huge number of users in a highly distributed mesh network.

Your butter framework looked like a very intriguing possibility to perhaps try and use if it can be made to work since it seems to have some nice features already built into the framework.

With your latest modifications, I built it with Go v1.19.3 (windows/amd64) and just tried it out, but ran into a new set of errors:

PS D:\test\newStuff\butter\test> go build -o ohce.exe .\examples\ohce\main.go
PS D:\test\newStuff\butter\test> .\ohce.exe

Node is listening at 192.168.0.28:54668
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x9ffbdc]

goroutine 19 [running]:
github.com/butter-network/butter/discover.ListenForMulticasts({0xcc0bb8, 0xc00000a090})
        D:/test/newStuff/butter/test/discover/discover.go:115 +0xbc
created by github.com/butter-network/butter/discover.Discover
        D:/test/newStuff/butter/test/discover/discover.go:73 +0x16b
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x9ff86a]

goroutine 8 [running]:
github.com/butter-network/butter/discover.PingLAN({0xcc0bb8, 0xc00000a090})
        D:/test/newStuff/butter/test/discover/discover.go:88 +0xaa
github.com/butter-network/butter/discover.Discover({0xcc0bb8, 0xc00000a090})
        D:/test/newStuff/butter/test/discover/discover.go:75 +0x1c5
created by github.com/butter-network/butter.Spawn
        D:/test/newStuff/butter/test/p2p.go:22 +0x85

I have am running on a local lan (192.168 subnet) and have a few computers on this network. (Linux Ubuntu 21.10 and 2 Windows 10 (x64) systems) for testing and development.

Any thoughts?

a-shine commented 1 year ago

Hiya,

Hmmm, looks like something is preventing the default Go net.ListenMulticastUDP() function from working - could be something configured on the network. Do you know if you're network allows for Multicast? Back at university, I used to be unable to run the framework on lab computers cause they blocked Multicast, but on my mobile network or home wifi it was totally fine. If you have a smartphone to hand (and a wireless card on your computer), I suggest you try with a mobile hotspot to see if that works. Then we'll know if it's the network.

What your working on seems very interesting! If you want more immediate help setting up and discussing the framework happy to jump on a call sometime in the next few days...

Regards, Alex