package config

import (
	"cicv-data-closedloop/aarch64/pjisuv/common/config"
	"cicv-data-closedloop/common/config/c_log"
	"net"
	"os"
)

var TcpListener net.Listener

func InitTcpListener() {
	c_log.GlobalLogger.Info("从节点初始化TCP端口监听 - 开始。")
	socket := config.CloudConfig.Hosts[1].Ip + ":" + config.CloudConfig.TcpPort
	var err error
	TcpListener, err = net.Listen("tcp", socket)
	if err != nil {
		c_log.GlobalLogger.Error("监听tcp端口失败:", err)
		os.Exit(-1)
	}
	c_log.GlobalLogger.Info("从节点初始化TCP端口监听 - 成功：", socket)
}
