Пример #1
0
func (this *Client) ConnectToMsgServer() (err error) {
	this.keysession, err = libnet.ConnectTimeout(this.cfg.Server_Network, this.cfg.KeyServer_Addr, time.Second*time.Duration(this.cfg.ConnectTimeout), libnet.NewDefCodec(1, 1024, 1024, libnet.BigEndian, this.keycodec))
	if err != nil {
		return err
	}
	this.session, err = libnet.ConnectTimeout(this.cfg.Server_Network, this.cfg.Server_Addr, time.Second*time.Duration(this.cfg.ConnectTimeout),
		libnet.NewDefCodec(2, 1024*1024, 1024, libnet.BigEndian, this.customcodec))
	return err
}
Пример #2
0
func (this *MsgServer) ConnectToServer() (err error) {
	this.wsSession, err = libnet.ConnectTimeout(this.cfg.Server_Network, this.cfg.Server_Addr, time.Second*time.Duration(this.cfg.ConnectTimeout), libnet.NewDefCodec(2, 2*1024, 2*1024, libnet.BigEndian, this.customCodec))
	return err
}
Пример #3
0
func (this *Client) ConnectToGatewayServer() (err error) {
	this.session, err = libnet.ConnectTimeout(this.cfg.Server_Network, this.cfg.Server_Addr, time.Second*time.Duration(this.cfg.ConnectTimeout),
		libnet.NewDefCodec(1, 1024, 1024, libnet.BigEndian, this.keycodec))
	return err
}