Esempio n. 1
0
 public HttpServer(Context context, HttpConnectionCallback callback, Socket socket, bool closeOnEnd = false)
 {
     this.callback = callback;
     this.socket = socket;
     this.closeOnEnd = closeOnEnd;
     this.Context = context;
 }
Esempio n. 2
0
		public IdentClient(Context context, string server, int port)
		{
			Context = context;
			Server = server;
			Port = port;
			Encoding = Encoding.Default;
		}
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Manos.IO.Socket"/> class.
        /// </summary>
        /// <param name='context'>
        /// The context this socket will be bound to.
        /// </param>
        protected Socket(Context context)
        {
            if (context == null)
                throw new ArgumentNullException ("context");

            this.context = context;
        }
Esempio n. 4
0
		public SignalWatcher(Context context, Signum signum, Action callback)
			: this(context, new Signum[] { signum }, (num) => {
				if (callback != null) {
					callback();
				}
			})
		{
		}
Esempio n. 5
0
		public Socks4Socket(Context context, string proxyHost, int proxyPort, string userId)
			: base(context)
		{
			Socket = context.CreateSocket();
			ProxyHost = proxyHost;
			ProxyPort = proxyPort;
			UserId = userId;
		}
Esempio n. 6
0
        public Boundary(Context context, int maxWorkPerLoop)
        {
            asyncWatcher = context.CreateAsyncWatcher(ProcessWork);
            asyncWatcher.Start();

            workQueue = new ConcurrentQueue<Action>();
            this.maxWorkPerLoop = maxWorkPerLoop;
        }
Esempio n. 7
0
 Socket(Context loop, System.Net.Sockets.Socket socket)
     : this(loop)
 {
     this.socket = socket;
     this.address = ((IPEndPoint) socket.RemoteEndPoint).Address.ToString ();
     this.port = ((IPEndPoint) socket.RemoteEndPoint).Port;
     this.state = Socket.SocketState.Open;
 }
Esempio n. 8
0
        public IrcBot(Context context)
            : base(context)
        {
            DefaultPrefix = "!";

              OnChannelMessage += HandleOnChannelMessage;
              OnQueryMessage   += HandleOnQueryMessage;
              OnJoin += HandleOnJoin;
        }
Esempio n. 9
0
        public FileStream(Context loop, System.IO.FileStream stream, int blockSize)
            : base(loop, blockSize)
        {
            if (loop == null)
                throw new ArgumentNullException ("loop");
            if (stream == null)
                throw new ArgumentNullException ("stream");

            this.stream = stream;
        }
Esempio n. 10
0
        public ManosTwitter(Context context, OAuthTokens oauthtokens, TaskScheduler scheduler)
        {
            Context = context;
            TaskScheduler = scheduler;
            OAuthTokens = oauthtokens;

            callbacks = new AsyncWatcher<Action>(Context, (callback) => {
                callback();
            });
            callbacks.Start();
        }
Esempio n. 11
0
        public HttpResponse(Context context, IHttpRequest request, ITcpSocket socket)
            : base(context)
        {
            Request = request;
            Socket = socket;

            StatusCode = 200;

            WriteHeaders = true;

            Stream = new HttpStream (this, socket.GetSocketStream ());
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Esempio n. 12
0
        public HttpRequest(Context context, string address)
            : base(context)
        {
            Uri uri = null;

            if (!Uri.TryCreate (address, UriKind.Absolute, out uri))
                throw new Exception ("Invalid URI: '" + address + "'.");

            RemoteAddress = uri.Host;
            RemotePort = uri.Port;
            Path = uri.AbsolutePath;

            Method = HttpMethod.HTTP_GET;
            MajorVersion = 1;
            MinorVersion = 1;
        }
Esempio n. 13
0
		public static void Init(Context context)
		{
			Window.Init();

			Running = true;

			Curses.Raw = true;
			Curses.Echo = false;

			Curses.start_color();
			Curses.use_default_colors();

			Window.Standard.Keypad = true;

			Context = context;
		}
Esempio n. 14
0
		public SignalWatcher(Context context, Signum[] signals, Action<Signum> callback)
		{
			Signals = signals;
			unixSignals = new UnixSignal[signals.Length];
			for (int i = 0; i < signals.Length; i++) {
				unixSignals[i] = new UnixSignal(signals[i]);
			}

			watcher = new AsyncWatcher<Signum>(context, (key) => {
				if (callback != null) {
					callback(key);
				}
			});

			thread = new Thread((o) => {
				while (true) {
					var index = UnixSignal.WaitAny(unixSignals);
					watcher.Send(Signals[index]);
				}
			});
		}
Esempio n. 15
0
		public Socks4Server(Context context, Socket socket)
		{
			Context = context;
			Socket = socket;
			VersionCheck = true;
		}
Esempio n. 16
0
		public IdentServer(Context context)
		{
			Context = context;
			Encoding = Encoding.Default;
		}
Esempio n. 17
0
 public HttpRequest(Context context, string remote_address, int port)
     : this(context, remote_address)
 {
     RemotePort = port;
 }
Esempio n. 18
0
		public IdentClient(Context context, string server)
			: this(context, server, 113)
		{
		}
Esempio n. 19
0
 static AppHost()
 {
     context = Context.Create ();
 }
Esempio n. 20
0
 public Boundary(Context context)
     : this(context, 18)
 {
 }
Esempio n. 21
0
 public Socket(Context loop)
     : base(loop)
 {
 }
Esempio n. 22
0
 public ManosTwitter(Context context, OAuthTokens oauthtokens)
     : this(context, oauthtokens, TaskScheduler.Default)
 {
 }