Write() public method

public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
return void
Example #1
0
        public void Execute()
        {
            Socket = AppHost.IOLoop.CreateSocket();
            Socket.Connect(RemoteAddress, RemotePort, delegate {
                Stream            = new HttpStream(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(() => {
                    HttpResponse response = new HttpResponse(this, Socket);

//					response.OnCompleted += () => {
//						if (OnResponse != null)
//							OnResponse (response);
//					};

                    response.Read(() => {
                        if (OnResponse != null)
                        {
                            OnResponse(response);
                        }
                    });
                });
            });
        }
Example #2
0
        public void Execute()
        {
            var remote = new IPEndPoint(IPAddress.Parse(RemoteAddress), RemotePort);

            Socket = this.Context.CreateTcpSocket(remote.AddressFamily);
            Socket.Connect(remote, delegate {
                Stream            = new HttpStream(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(() => {
                    HttpResponse response = new HttpResponse(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
            });
        }
Example #3
0
 public override void Write(byte[] buffer, int offset, int count)
 {
     stream.Write((byte [])buffer.Clone(), offset, count);
 }
Example #4
0
        public void Execute()
        {
            Socket = AppHost.Context.CreateSocket ();
            Socket.Connect (RemoteAddress, RemotePort, delegate {
                Stream = new HttpStream (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 (() => {
                    HttpResponse response = new HttpResponse (Context, this, Socket);

            //					response.OnCompleted += () => {
            //						if (OnResponse != null)
            //							OnResponse (response);
            //					};

                    response.Read (() => {
                        if (OnResponse != null) OnResponse (response);
                    });
                });
            });
        }
Example #5
0
        public void Execute()
        {
            var remote = new IPEndPoint(IPAddress.Parse (RemoteAddress), RemotePort);
            Socket = this.Context.CreateTcpSocket (remote.AddressFamily);
            Socket.Connect (remote, delegate {
                Stream = new HttpStream (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 (() => {
                    HttpResponse response = new HttpResponse (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
            });
        }