示例#1
0
		public static async Task<Version> NegotiateVersionWithServer (Stream stream, VersionRange[] supportedVersions)
		{
			var clientVersion = supportedVersions.First ().UpperBoundInclusive;
			await stream.WriteVersionAsync (clientVersion);
			var serverVersion = await stream.ReadVersionAsync ();
			var negotiatedVersion = DecideWhichVersionToUse (clientVersion, serverVersion);
			return negotiatedVersion;
		}