/// <summary> /// new /// </summary> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public SocketClient(Protocol.IProtocol <TMessage> protocol, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { if (protocol == null) { throw new ArgumentNullException("protocol"); } this._protocol = protocol; if (protocol.IsAsync) { this._connectionPool = new AsyncPool(); } else { this._connectionPool = new SyncPool(); } this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this); this._receivingQueue = new ReceivingQueue(this); this._endPointManager = new EndPointManager(this); this._endPointManager.Connected += this.OnEndPointConnected; this._endPointManager.Already += this.OnEndPointAlready; }
void Awake() { character = GetComponent <Character>(); receivingQueue = GetComponent <ReceivingQueue>(); }