/// <summary> /// Converts the TCB into a byte array. /// </summary> /// <returns></returns> public byte[] ToArray() { byte[] buffer = new byte[40]; byte[] sourceAddress = this.SourceEndPoint.Address.GetAddressBytes(); byte[] destinationAddress = this.DestinationEndPoint.Address.GetAddressBytes(); int offset = 0; offset += NetworkHelpers.CopyTo(this.CreationTime.Ticks, buffer, offset); offset += NetworkHelpers.CopyTo(this.Lifetime.Ticks, buffer, offset); offset += NetworkHelpers.CopyTo(sourceAddress.Length, buffer, offset); offset += NetworkHelpers.CopyTo(sourceAddress, buffer, offset, false); offset += NetworkHelpers.CopyTo(this.SourceEndPoint.Port, buffer, offset); offset += NetworkHelpers.CopyTo(destinationAddress.Length, buffer, offset); offset += NetworkHelpers.CopyTo(destinationAddress, buffer, offset, false); offset += NetworkHelpers.CopyTo(this.DestinationEndPoint.Port, buffer, offset); return(buffer); }