Esempio n. 1
0
		public HTTPSession(IPEndPoint Local, Socket TheSocket)
		{
			/* Eveything calls this */

			OpenSource.Utilities.InstanceTracker.Add(this);

			this.Connected = TheSocket.Connected;
			local_ep = Local;

			MainSocket = new AsyncSocket(4096);
			MainSocket.Attach(TheSocket);
			MainSocket.OnReceive += new AsyncSocket.OnReceiveHandler(HandleReceive);
			MainSocket.OnDisconnect += new AsyncSocket.ConnectHandler(HandleDisconnect);
			MainSocket.OnSendReady += new AsyncSocket.OnSendReadyHandler(HandleReady);
			/* This is New */
			//MainSocket.BufferReadLength = 1;
			MainSocket.BufferReadLength = 1024;
		}
        public override void Start(UPnPDevice device)
        {
            UPnPDevice d = device;
            while (d.ParentDevice != null)
            {
                d = d.ParentDevice;
            }
            TestDevice = d;

            ASocket = new AsyncSocket(4096);
            ASocket.Attach(new IPEndPoint(TestDevice.InterfaceToHost, 0), System.Net.Sockets.ProtocolType.Udp);
            ASocket.SetTTL(4);
            ASocket.AddMembership((IPEndPoint)ASocket.LocalEndPoint, IPAddress.Parse("239.255.255.250"));
            ASocket.OnReceive += new AsyncSocket.OnReceiveHandler(ReceiveSink);
            ASocket.Begin();

            ASocket2 = new AsyncSocket(4096);
            ASocket2.Attach(new IPEndPoint(TestDevice.InterfaceToHost, 1900), System.Net.Sockets.ProtocolType.Udp);
            ASocket2.SetTTL(2);
            ASocket2.AddMembership((IPEndPoint)ASocket.LocalEndPoint, IPAddress.Parse("239.255.255.250"));
            ASocket2.OnReceive += new AsyncSocket.OnReceiveHandler(ReceiveSink2);

            Validate_MSEARCH_RESPONSETIME();
            Validate_NOTIFY();
            Validate_DISCOVERY();

            UPnPTestStates RetState = UPnPTestStates.Pass;
            if (NOTIFY == UPnPTestStates.Failed || DISCOVERY == UPnPTestStates.Failed)
            {
                RetState = UPnPTestStates.Failed;
            }
            else
            {
                if (NOTIFY == UPnPTestStates.Warn || DISCOVERY == UPnPTestStates.Warn || MX == UPnPTestStates.Warn)
                {
                    RetState = UPnPTestStates.Warn;
                }
            }

            state = RetState;
        }
Esempio n. 3
0
		/// <summary>
		/// Creates a new HTTPSession
		/// </summary>
		/// <param name="Local">Source IPEndPoint to use</param>
		/// <param name="Remote">Remote IPEndPoint to connect to</param>
		/// <param name="CreateCallback">Succussful callback</param>
		/// <param name="CreateFailedCallback">Failed callback</param>
		/// <param name="State">StateObject</param>
		public HTTPSession(IPEndPoint Local, IPEndPoint Remote, SessionHandler CreateCallback, SessionHandler CreateFailedCallback, Object State)
		{
			OpenSource.Utilities.InstanceTracker.Add(this);
			local_ep = Local;
			
			OnCreateSession += CreateCallback;
			OnCreateFailed += CreateFailedCallback;

			StateObject = State;

			MainSocket = new AsyncSocket(4096);
			MainSocket.Attach(Local,ProtocolType.Tcp);
			MainSocket.OnConnect += new AsyncSocket.ConnectHandler(HandleConnect);
			MainSocket.OnConnectFailed += new AsyncSocket.ConnectHandler(HandleConnectFailed);
			MainSocket.OnDisconnect += new AsyncSocket.ConnectHandler(HandleDisconnect);
			MainSocket.OnSendReady += new AsyncSocket.OnSendReadyHandler(HandleReady);

			MainSocket.Connect(Remote);
		}