Exemple #1
0
        public void Request(IRequesterActions actions, IListenerAddress address)
        {
            bool connected = true;
            StreamSocket socket = new StreamSocket();
            try
            {
                if (socket.Information.RemoteAddress == null)
                {
                    socket.ConnectAsync(new HostName(address.Ip), address.Port).AsTask().Wait();
                }
            }
            catch (Exception e)
            {
                connected = false;
                Debug.WriteLine(e.ToString());
            }

            if (connected)
            {
                Send(actions,socket);
            }
        }
        public void Request(IRequesterActions actions, IListenerAddress address)
        {
            bool connected = true;
            _actions = actions;
            _address = address;
            try
            {
                if (_socket.Socket.Information.RemoteAddress == null)
                {
                    _socket.Socket.ConnectAsync(new HostName(_address.Ip), _address.Port).AsTask().Wait();
                }
            }
            catch (Exception e)
            {
                connected = false;
                Debug.WriteLine(e.ToString());
            }

            if(connected)
            {
                while(Stream());
            }
        }