473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to connect Alternate down load server using vc++

1
Hi this is krishna

I have two download servers . If one server is busy or not find then I have to connect alternate download server. already i have example code using this we can connect download server . plz any body help me

CString strURL;
CString strPort;
CString strPath;
CString strAffiliateID;
mapURLs.Lookup(_T("DownloadServer"),strURL);
mapURLs.Lookup(_T("DownloadServerPort"),strPort);
mapURLs.Lookup(_T("DownloadServerPath"),strPath);
mapURLs.Lookup(_T("AffiliateID"),strAffiliateID);
CString compData = _T("");
int nDownloaded = 0; // Downloaded complete verifier

CInternetSession netSession;
TCHAR filebuf[513];
CStdioFile *pTargFile = NULL;
CString upgrade_file;
upgrade_file.Format(_T("http://%s:%s%s%s_comp.ver"),
strURL,
strPort,
strPath,
strAffiliateID
);
//AfxMessageBox(upgrade_file);
//Sleep(500);
try {
pTargFile = netSession.OpenURL(upgrade_file,
1,
INTERNET_FLAG_TRANSFER_BINARY |
INTERNET_FLAG_RELOAD);

nDownloaded = 1; // File has been found, downloading starts

//int byteswrite; // Number of bytes to write into the file
filebuf[0]=0;
//AfxMessageBox("before while");
int bytesread = 0;
while(bytesread = pTargFile->Read(filebuf,512)){
filebuf[bytesread]=0;
compData += filebuf;
filebuf[0]=0;
}
} catch(CInternetException *ie) {
//AfxMessageBox("CInternetException");
nDownloaded = 0;
CString strerror; // String variable
TCHAR error[256]; // Error message buffer
ie->GetErrorMessage(error,255); // Get error message
strerror = error; // Transfer into the CString object
if(pTargFile != NULL) {
delete pTargFile;
pTargFile = NULL;
}
ie->Delete();
compData.Empty();
return compData;
}
if(pTargFile != NULL) {
delete pTargFile;
pTargFile = NULL;
}
//AfxMessageBox(compData);
return compData;
}
Apr 16 '07 #1
1 1662
MMcCarthy
14,534 Expert Mod 8TB
This question is being moved to the C++ forum.

ADMIN
Apr 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Mohammed AlQuraishi | last post by:
Hi all, I'm trying to connect to an MS Access database using ADO.NET and C#, but I'm getting the dreaded "Microsoft Jet database engine cannot open the file 'x'. It is already opened exclusively...
5
by: yadavindrian01 | last post by:
Hi all Please tell me if I can connect to SQL database through C++, Please help
1
by: Dave | last post by:
I am trying to learn .NET with the standard edition of VC++.NET 2003 Standard edition. When I use the wizard in the toolbox to connect to a non-microsoft ODBC data source, I get the error message...
2
by: jason | last post by:
I discovered this morning that a few of my sites have routines to automatically email when pages are accessed. These pages were down becuase the the smtp server I'm using was down. I would see a...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
4
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I need to post a form to an alternate technology. I have created pop up windows that on post back will open a new window, but this uses get. I need to encode variables and POST to a new window on...
9
by: johkar | last post by:
I need some browser implementation clarification. In the below example, the alternate stylesheet could be invoked by user agents that support alternate stylesheets or by script. Are there any...
0
by: zgh1970 | last post by:
Hi, All, I have some question on the alternate server for the DB connection on db2 connect server. There is one db2 connection to one host database on the server with the following cfg: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.