public void write(int id, int type, int area, int command, object message) { UserToken token = userBiz.getToken(id); if (token == null) { return; } Console.WriteLine("有消息发出"); byte[] bs = MessageEncoding.Encode(createSocketModel(type, area, command, message)); bs = LengthEncoding.encode(bs); token.write(bs); }
/// <summary> /// 通过用户ID获取连接 /// </summary> /// <param name="id"></param> /// <returns></returns> public UserToken getToken(int id) { return(userBiz.getToken(id)); }