增加全部清理tcp客户端

pull/30/head
taoshihan1991 4 years ago
parent 08eff50ce1
commit 8c766d2c2d

@ -27,7 +27,8 @@ func NewTcpServer(tcpBaseServer string){
}
func PushServerTcp(str []byte){
for ip,conn:=range clientTcpList{
_,err:=conn.Write(str)
line:=append(str,[]byte("\r\n")...)
_,err:=conn.Write(line)
log.Println(ip,err)
if err!=nil{
conn.Close()
@ -43,6 +44,10 @@ func DeleteOnlineTcp(c *gin.Context) {
conn.Close()
delete(clientTcpList,ip)
}
if ip=="all"{
conn.Close()
delete(clientTcpList,ipkey)
}
}
c.JSON(200, gin.H{
"code": 200,

Loading…
Cancel
Save