Comments (6)
If add a return error on OnConnectHandler api?? if return error, indicate refuse the connection from server?? It seem like a idea.
from go-iecp5.
OnConnectionHandler does not implement a return error statement. Do you mean should I implement the return error statement to the source code ?
// SetOnConnectionHandler set on connect handler
func (sf *Server) SetOnConnectionHandler(f func(asdu.Connect)) {
sf.onConnection = f
}
if I refuse connections by closing them client is attempting in a infinite loop.
mainServer = cs104.NewServer(&myServer{})
mainServer.SetOnConnectionHandler(func(asd asdu.Connect){
asd.UnderlyingConn().Close()
})
from go-iecp5.
@ecoshub YES,OnConnectionHandler should implement a return error statement to the source code.
// SetOnConnectionHandler set on connect handler
func (sf *Server) SetOnConnectionHandler(f func(asdu.Connect) error ) {
sf.onConnection = f
}
in the file server_session.go
line 206 - 218
defer func() {
sf.setConnectStatus(disconnected)
checkTicker.Stop()
_ = sf.conn.Close() // 连锁引发cancel
sf.wg.Wait()
if sf.connectionLost != nil {
sf.connectionLost(sf)
}
sf.Debug("run stopped!")
}()
if err := sf.onConnection(sf);err!= nil{
return
}
we can not forbid the client attempting in a infinite loop. only we can do, just refuse it.
what about this idea?
from go-iecp5.
Yes I am currently doing that without implementing any other code to the source code. I am just closing the connection with asdu.UnderlyingConn().Close()
. That is not the case.
Let me rephrase the question. Does iec 60870-5 104 protocol has any ASDU command for closing the connection from server like client do with StopDT and does this package has any thing like that?
from go-iecp5.
sorry ,I can not find. you can refer to lib60870 c library lib60870 doc, maybe you can get an idea.
from go-iecp5.
Thank you so much for your help I will read doc again for an answer. If there is no answer for my question in the doc I will try to find out a solution and post it from here.
from go-iecp5.
Related Issues (14)
- cs104 common server send spont and periodic message HOT 1
- Supporting IEC101 HOT 2
- master-slave mode
- 使用示例 HOT 2
- Joint Forces HOT 1
- 总召唤确认报文 HOT 12
- sever add tls mode
- Read data HOT 3
- 读命令使用
- about client example? HOT 2
- support client ?? HOT 2
- 104服务端崩溃 HOT 2
- What about implement synchronous Read and Write functions HOT 1
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 go-iecp5.