Exemplo n.º 1
0
        /// <summary>
        /// Sends the initial descriptor to the file descriptor socket
        /// </summary>
        /// <returns>An awaitable task.</returns>
        private async Task SetupDescriptorSocket()
        {
            using (var ms = new System.IO.MemoryStream())
                using (var bcs = new BinaryConverterStream(ms, m_fdSocketTypeSerializer))
                {
                    await bcs.WriteObjectAsync(new InitialProtocolDescription()
                    {
                        Version          = 1,
                        ServerHandle     = ((IRemoteInstance)m_proxy).Handle,
                        RequestSignature = m_fdSocketTypeSerializer.GetShortTypeDefinition(typeof(SocketRequest))
                    });

                    await bcs.FlushAsync();

                    m_fdSocket.Send(ms.ToArray());

                    Program.DebugConsoleOutput($"Sent protocol data with {ms.Length} bytes to {m_proc.Id}");
                }
        }