Click here to Skip to main content
14,662,328 members
Home » Discussions » C#
   

C#

 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
Henry Minute10-Jun-09 6:31
MemberHenry Minute10-Jun-09 6:31 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
WinSolution10-Jun-09 6:38
MemberWinSolution10-Jun-09 6:38 
GeneralRe: urgent help pleasse [image processing , pointers , byte ] Pin
Luc Pattyn10-Jun-09 7:29
sitebuilderLuc Pattyn10-Jun-09 7:29 
GeneralRe: urgent help pleasse [image processing , pointers , byte ] Pin
Christian Graus10-Jun-09 8:46
mveChristian Graus10-Jun-09 8:46 
AnswerRe: urgent help pleasse [image processing , pointers , byte ] Pin
saurabh sahay10-Jun-09 11:50
Membersaurabh sahay10-Jun-09 11:50 
QuestionHttpResponse Compression... ? Pin
Trapper-Hell10-Jun-09 5:54
MemberTrapper-Hell10-Jun-09 5:54 
AnswerRe: HttpResponse Compression... ? Pin
Colin Angus Mackay10-Jun-09 6:15
MemberColin Angus Mackay10-Jun-09 6:15 
AnswerRe: HttpResponse Compression... ? Pin
saurabh sahay10-Jun-09 6:18
Membersaurabh sahay10-Jun-09 6:18 
Please go through the following article which contains exactly what you need

Using HTTP Compression for Faster Downloads[^]


If you need to increase the speed further then you may use the below code which actually deals in sockets and increases the speed to many folds when parallel downloading is going on.

public class MyWebResponse
{
public MyWebResponse()
{
}
public void Connect(MyWebRequest request)
{
ResponseUri = request.RequestUri;

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint remoteEP = new IPEndPoint(Dns.Resolve(ResponseUri.Host).AddressList[0], ResponseUri.Port);
socket.Connect(remoteEP);
}
public void SendRequest(MyWebRequest request)
{
ResponseUri = request.RequestUri;

request.Header = request.Method + " " + ResponseUri.PathAndQuery + " HTTP/1.0\r\n" + request.Headers;
socket.Send(Encoding.ASCII.GetBytes(request.Header));
}
public void SetTimeout(int Timeout)
{
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, Timeout * 1000);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, Timeout * 1000);
}
public void ReceiveHeader()
{
Header = "";
Headers = new WebHeaderCollection();

byte[] bytes = new byte[10];
while (socket.Receive(bytes, 0, 1, SocketFlags.None) > 0)
{
Header += Encoding.ASCII.GetString(bytes, 0, 1);
if (bytes[0] == '\n' && Header.EndsWith("\r\n\r\n"))
break;
}
MatchCollection matches = new Regex("[^\r\n]+").Matches(Header.TrimEnd('\r', '\n'));
for (int n = 1; n < matches.Count; n++)
{
string[] strItem = matches[n].Value.Split(new char[] { ':' }, 2);
if (strItem.Length > 0)
Headers[strItem[0].Trim()] = strItem[1].Trim();
}
// check if the page should be transfered to another location
if (matches.Count > 0 && (
matches[0].Value.IndexOf(" 302 ") != -1 ||
matches[0].Value.IndexOf(" 301 ") != -1))
// check if the new location is sent in the "location" header
if (Headers["Location"] != null)
{
try { ResponseUri = new Uri(Headers["Location"]); }
catch { ResponseUri = new Uri(ResponseUri, Headers["Location"]); }
}
ContentType = Headers["Content-Type"];
if (Headers["Content-Length"] != null)
ContentLength = int.Parse(Headers["Content-Length"]);
KeepAlive = (Headers["Connection"] != null && Headers["Connection"].ToLower() == "keep-alive") ||
(Headers["Proxy-Connection"] != null && Headers["Proxy-Connection"].ToLower() == "keep-alive");
}
public void Close()
{
socket.Close();
}
public Uri ResponseUri;
public string ContentType;
public int ContentLength;
public WebHeaderCollection Headers;
public string Header;
public Socket socket;
public bool KeepAlive;
}


2)
GeneralRe: HttpResponse Compression... ? Pin
Trapper-Hell10-Jun-09 6:25
MemberTrapper-Hell10-Jun-09 6:25 
GeneralRe: HttpResponse Compression... ? Pin
saurabh sahay10-Jun-09 6:35
Membersaurabh sahay10-Jun-09 6:35 
QuestionExtracting Repeating Table Data In a Web Part Pin
lday8610-Jun-09 5:42
Memberlday8610-Jun-09 5:42 
Questionchanging the color and text of the label control dynamically from the retrieved values from the database Pin
praveenkumar_vittaboina10-Jun-09 4:58
Memberpraveenkumar_vittaboina10-Jun-09 4:58 
AnswerRe: changing the color and text of the label control dynamically from the retrieved values from the database Pin
Tom Deketelaere10-Jun-09 5:22
professionalTom Deketelaere10-Jun-09 5:22 
Questioncrystal reports problem after installing the application. Pin
praveenkumar_vittaboina10-Jun-09 4:57
Memberpraveenkumar_vittaboina10-Jun-09 4:57 
AnswerRe: crystal reports problem after installing the application. Pin
Tom Deketelaere10-Jun-09 5:19
professionalTom Deketelaere10-Jun-09 5:19 
QuestionChecking a registry key exists Pin
Martin3108810-Jun-09 4:21
MemberMartin3108810-Jun-09 4:21 
AnswerRe: Checking a registry key exists Pin
Henry Minute10-Jun-09 4:45
MemberHenry Minute10-Jun-09 4:45 
GeneralRe: Checking a registry key exists Pin
Martin3108810-Jun-09 4:57
MemberMartin3108810-Jun-09 4:57 
GeneralRe: Checking a registry key exists Pin
Henry Minute10-Jun-09 5:07
MemberHenry Minute10-Jun-09 5:07 
GeneralRe: Checking a registry key exists Pin
Martin3108810-Jun-09 5:35
MemberMartin3108810-Jun-09 5:35 
GeneralRe: Checking a registry key exists Pin
Henry Minute10-Jun-09 6:16
MemberHenry Minute10-Jun-09 6:16 
GeneralRe: Checking a registry key exists Pin
Martin3108810-Jun-09 6:28
MemberMartin3108810-Jun-09 6:28 
GeneralRe: Checking a registry key exists Pin
Martin3108810-Jun-09 23:57
MemberMartin3108810-Jun-09 23:57 
Questioncheckedlistbox - save checked items for future run Pin
havejeet10-Jun-09 3:50
Memberhavejeet10-Jun-09 3:50 
AnswerRe: checkedlistbox - save checked items for future run Pin
Manas Bhardwaj10-Jun-09 3:51
professionalManas Bhardwaj10-Jun-09 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.