Comments (6)
Hi @darinkes
I believe that Go will give priority to the IPv6 when the server supports both IPv4 and IPv6, have you ever tried "udp4"?
from gnet.
According to tcpdump its an IPv4 connection from 127.0.0.1 to 127.0.0.1.
E.g. listenAddr
is "udp://127.0.0.1:5555"
Works fine with net.ListenUDP("udp", listenAddr)
, which also gives a correct RemoteAddr()
[::7f00:1] is the result of mangled data cause of the bug in eventloop.go
udp4
does not seem to exist:
listen udp4 127.0.0.1:5555: address 127.0.0.1:5555: unexpected address type
from gnet.
I've run a test with UDP on my linux server and printed some logs:
It seems that everything goes well, so could you make sure that the listenAddr := fmt.Sprintf("udp://%s", this.cfg.Bind)
passes the right arguments to gnet
?Maybe you print the whole string of it and check it out?
from gnet.
BTY, you could update to the latest code of gnet and try it again, let's see whether the issue still exists.
from gnet.
func (this *Server) OnInitComplete(srv gnet.Server) (action gnet.Action) {
log.Debugf("Server is listening on %s (multi-cores: %t, loops: %d)", srv.Addr.String(), srv.Multicore, srv.NumLoops)
return
}
func (this *Server) React(c gnet.Conn) (out []byte, action gnet.Action) {
log.Debugf("%v -> %v", c.RemoteAddr(), c.LocalAddr())
}
Results in
2019-11-11 15:25:15 [DEBUG] (udp/server): Server is listening on 127.0.0.1:5555 (multi-cores: true, loops: 24)
2019-11-11 15:25:16 [DEBUG] (udp/server): [::7f00:1]:55170 -> 127.0.0.1:5555
I saw you fixed it in master now: ec7bd36 👍
Thats nearly the same fix I also applied in my local gnet checkout and it works.
from gnet.
checked out master and now it shows
2019-11-11 15:44:00 [DEBUG] (udp/server): 127.0.0.1:44772 -> 127.0.0.1:5555
Thanks for fixing this so quick
from gnet.
Related Issues (20)
- [Question]: gnet打印很多error occurs in user-defined function, use of closed network connection HOT 1
- 哥 client 的使用好复杂啊 HOT 3
- [Question]: Server端回包立刻关闭连接,OnTraffic 收不到最后一个包的数据 HOT 11
- [Question]: ReadFrom系列函数的作用 HOT 1
- [Feature]: Support for SO_BINDTODEVICE? HOT 4
- 一条链接往外写数据,内存增长很快。 HOT 4
- [Feature]: Can this be part of the roadmap for practical use case as top priority. tls / ktls support first. HOT 8
- [Feature]: 有没有详细的教程 新手根本不知道咋用 HOT 2
- [Question]: 请教一个问题:关于使用独立的 worker pool 处理阻塞的业务逻辑 HOT 2
- 如何通知GNet关闭某个链接?[Question]: HOT 1
- [Bug]: 2.3.5 onOpen和onClose执行次数不一致 HOT 15
- [Feature]: 为 Client.Enroll/Dial 提供同步 callback HOT 9
- [Feature]: gnet.Conn 增加一个并发安全的map HOT 2
- [Question]: remoteAddr为什么是空的 HOT 3
- [Bug]: memory leaks in `conn.release`
- [Feature]: enable `OnOpen` when UDP socket is connected HOT 2
- [Question]: gnet.run()时提示错误:gnet engine is stopping with error: kevent add|clear:function not implemented HOT 2
- [Question]: gnet engine is stopping with error: kevent add|clear:function not implemented HOT 5
- [Question]: 您好大佬,这个库的epoll的底层实现是用纯go实现的吗?没有用到cgo是吧? HOT 1
- [Feature]: how to disable logging? replace uber zap with zerolog too pls HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnet.