public static void SecureListenAt(IPEndPoint endPoint, string cert, string key) { if (endPoint == null) throw new ArgumentNullException("endPoint"); if (cert == null) throw new ArgumentNullException("cert"); if (key == null) throw new ArgumentNullException("key"); if (secureListenEndPoints.ContainsKey(endPoint) || listenEndPoints.Contains(endPoint)) throw new InvalidOperationException("Endpoint already registered"); secureListenEndPoints.Add(endPoint, Tuple.Create(cert, key)); }
public void Execute() { var remote = new IPEndPoint(IPAddress.Parse (RemoteAddress), RemotePort); Socket = this.Context.CreateTcpSocket (remote.AddressFamily); Socket.Connect (remote, delegate { Stream = new Stream (this, Socket.GetSocketStream ()); Stream.Chunked = false; Stream.AddHeaders = false; byte [] body = GetBody (); if (body != null) { Headers.ContentLength = body.Length; Stream.Write (body, 0, body.Length); } Stream.End (() => { Response response = new Response (Context, this, Socket); // response.OnCompleted += () => { // if (OnResponse != null) // OnResponse (response); // }; response.Read (() => { if (OnResponse != null) OnResponse (response); }); }); }, ex => { // TODO: figure out what to do here }); }
public static void ListenAt(IPEndPoint endPoint) { if (endPoint == null) throw new ArgumentNullException("endPoint"); if (listenEndPoints.Contains(endPoint) || secureListenEndPoints.ContainsKey(endPoint)) throw new InvalidOperationException("Endpoint already registered"); listenEndPoints.Add(endPoint); }