Re: Socket Class Slower Then HTTP Web Request
From: Feroze [msft] (ferozed_at_online.microsoft.com)
Date: 03/25/05
- Next message: Matt Berther: "Re: best place to save application state?"
- Previous message: Feroze [msft]: "Re: HttpWebRequest and Host header (ANSWERED)"
- In reply to: mwieder_at_gmail.com: "Re: Socket Class Slower Then HTTP Web Request"
- Next in thread: Joerg Jooss: "Re: Socket Class Slower Then HTTP Web Request"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 25 Mar 2005 15:40:08 -0800
Look at this post, which will show you what the suggested way of downloading
is:
http://blogs.msdn.com/feroze_daud/archive/2004/03/30/104440.aspx
-- feroze ----------------- This posting is provided as-is. It offers no warranties and assigns no rights. See http://weblogs.asp.net/feroze_daud for System.Net related posts. ---------------- <mwieder@gmail.com> wrote in message news:1111764670.352222.307260@f14g2000cwb.googlegroups.com... > Hi - thanks for the suggestions - I understood everything you suggested > (see new code below) except the comment on the ASCIIEncoding - please > change th code below to illustarte what you are suggesting there. > thanks! > > public string Send(string HttpRequest) > { > m_sock = new Socket(ipe.AddressFamily, SocketType.Stream, > ProtocolType.Tcp); > > m_sock.Connect(ipe); > > Encoding ASCII = Encoding.ASCII; > > Byte[] ByteGet = ASCII.GetBytes(HttpRequest); > Byte[] RecvBytes = new Byte[16384]; > m_sock.Send(ByteGet, ByteGet.Length, 0); > Int32 bytes; > > StringBuilder sbDataReceived = new StringBuilder(); > > do > { > bytes = m_sock.Receive(RecvBytes, RecvBytes.Length, 0); > sbDataReceived.Append(ASCII.GetString(RecvBytes, 0, bytes)); > > } while (bytes > 0); > > m_sock.Shutdown(SocketShutdown.Both); > m_sock.Close(); > > return sbDataReceived.ToString(); > > } >
- Next message: Matt Berther: "Re: best place to save application state?"
- Previous message: Feroze [msft]: "Re: HttpWebRequest and Host header (ANSWERED)"
- In reply to: mwieder_at_gmail.com: "Re: Socket Class Slower Then HTTP Web Request"
- Next in thread: Joerg Jooss: "Re: Socket Class Slower Then HTTP Web Request"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|