コード例 #1
0
		/// <summary>
		/// Parse the bytes given, and return the number of commands parsed.
		/// </summary>
		/// <param name="bytes">The bytes representing the commands</param>
		/// <returns>The number of commands parsed</returns>
		private static int parseBytes(byte[] bytes) {
			int commands = 0;
			ConnectionState parser = new ConnectionState();
			parser.setObjectReceivedAction(args => commands++);
			parser.buffer = bytes;
			try {
				parser.update(bytes.Length);
			} catch {
				return 1;
			}
			return commands;
		}
コード例 #2
0
        /// <summary>
        /// Parse the bytes given, and return the number of commands parsed.
        /// </summary>
        /// <param name="bytes">The bytes representing the commands</param>
        /// <returns>The number of commands parsed</returns>
        private static int parseBytes(byte[] bytes)
        {
            int             commands = 0;
            ConnectionState parser   = new ConnectionState();

            parser.setObjectReceivedAction(args => commands++);
            parser.buffer = bytes;
            try {
                parser.update(bytes.Length);
            } catch {
                return(1);
            }
            return(commands);
        }
コード例 #3
0
 /// <summary>
 /// Advance the buffer in the state object.
 /// </summary>
 /// <param name="state">The state object</param>
 /// <param name="bytesRead">The number of bytes read from the socket.</param>
 private static void updateState(ConnectionState state, int bytesRead)
 {
     state.update(bytesRead);
 }
		/// <summary>
		/// Advance the buffer in the state object.
		/// </summary>
		/// <param name="state">The state object</param>
		/// <param name="bytesRead">The number of bytes read from the socket.</param>
		private static void updateState(ConnectionState state, int bytesRead) {
			state.update(bytesRead);
		}