Esempio n. 1
0
func NewAtDebugServer(id string, af *at.AtFrame) (*AtDebug, error) {

	ad := &AtDebug{}

	ad.AF = af
	ad.ZmqContext = af.ZmqContext

	ad.ServerMode = true

	ad.cmdPULL, _ = ad.ZmqContext.NewSocket(zmq.PULL)
	ad.cmdPULL.Bind(AD_ZMQ_PROXY_PULL + id)

	ad.pollIndex, _ = af.AppendZmqPollItem(zmq.PollItem{Socket: ad.cmdPULL, Events: zmq.POLLIN})

	if dir, err := filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
		return nil, err
	} else {
		ad.RootPath = dir + "/"
	}

	ad.LogPath = "log/"
	ad.FileName = "log"

	ad.logFile = nil

	ad.ResetServer()

	return ad, nil
}
Esempio n. 2
0
func NewAtReportServer(id string, af *at.AtFrame) (*AtReport, error) {

	ar := &AtReport{}

	ar.AF = af
	ar.ZmqContext = af.ZmqContext

	ar.ServerMode = true

	ar.cmdPULL, _ = ar.ZmqContext.NewSocket(zmq.PULL)
	ar.cmdPULL.Bind(AR_ZMQ_PROXY_PULL + id)

	ar.pollIndex, _ = af.AppendZmqPollItem(zmq.PollItem{Socket: ar.cmdPULL, Events: zmq.POLLIN})

	if dir, err := filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
		return nil, err
	} else {
		ar.RootPath = dir + "/"
	}

	ar.ReportPath = "report/"
	ar.FileName = "rpt"

	ar.rptFile = nil

	ar.ResetServer()
	ar.toWeb = make(chan []byte)
	ar.manager = make(chan net.Conn)
	go ar.RunForWeb()

	return ar, nil
}