Ejemplo n.º 1
0
        public void Connect()
        {
            TvDirectSocket = new Windows.Networking.Sockets.StreamSocket();
            TvDirectSocket.ConnectAsync(ConnectedHostName, ConnectedPort.ToString()).Completed += newConnected;
            ConnectionState = TvConnectionState.Connecting;

            Connecting?.Invoke();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends the given <paramref name="data"/>
        /// to the <see cref="Port.ReceiveBuffer"/>
        /// of the <see cref="Port.ConnectedPort"/>.
        /// </summary>
        /// <param name="data">Data to send.</param>
        /// <returns>True if the data was successfully sent,
        /// false if not.</returns>
        public override bool Send(ITransferable data)
        {
            if (CurrentIOMode != IOMode.Output || data.GetType() != typeof(Packet) || ConnectedPort?.CurrentIOMode != IOMode.Input)
            {
                return(false);
            }

            return(ConnectedPort?.Receive(data) ?? false);
        }