新增处理
This commit is contained in:
@@ -46,6 +46,7 @@ func (h *TCPHandler) HandleClient(conn net.Conn) {
|
|||||||
output = strings.ReplaceAll(output, "\n", "")
|
output = strings.ReplaceAll(output, "\n", "")
|
||||||
message = []byte(output)
|
message = []byte(output)
|
||||||
fmt.Printf("收到消息来自 %s: %s\n", conn.RemoteAddr(), message)
|
fmt.Printf("收到消息来自 %s: %s\n", conn.RemoteAddr(), message)
|
||||||
|
|
||||||
if !json.Valid(message) {
|
if !json.Valid(message) {
|
||||||
fmt.Printf("来自客户端的数据非法 %s\n", conn.RemoteAddr())
|
fmt.Printf("来自客户端的数据非法 %s\n", conn.RemoteAddr())
|
||||||
conn.Close()
|
conn.Close()
|
||||||
@@ -252,7 +253,6 @@ func (s *Server) StopRealTimeReporting(client *Client, message []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TimingReporting 定时上报数据
|
|
||||||
func (s *Server) TimingReporting(client *Client, message []byte) error {
|
func (s *Server) TimingReporting(client *Client, message []byte) error {
|
||||||
var msg Message
|
var msg Message
|
||||||
if err := json.Unmarshal(message, &msg); err != nil {
|
if err := json.Unmarshal(message, &msg); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user