Microsoft Visual C++ .NET Professional Projects - Premier Press
.pdf
IMPLEMENTING REMOTING |
Chapter 31 |
911 |
|
} |
|
|
|
|
|
|
|
if (m_nQNum > 10) |
|
|
|
{ |
|
|
|
//It’s only a 10 question Quiz |
|
|
|
String* pStrTemp; |
|
|
|
pStrTemp = “Your score is “; |
|
|
|
if (m_nCorrect < 5) |
|
|
|
pStrTemp = String::Concat(pStrTemp, m_nCorrect.ToString(), “ out of 10. “, “\nYou need to improve your GK.”);
else if (m_nCorrect > 5 && m_nCorrect < 7)
pStrTemp = String::Concat(pStrTemp, m_nCorrect.ToString(), “ out of 10. “, “\nGood work!”);
else
pStrTemp = String::Concat(pStrTemp, m_nCorrect.ToString(), “ out of 10. “, “\nExcellent job!”);
MessageBox::Show(pStrTemp, “Score”);
m_nQNum = 1; m_nCorrect = 0; bButttonReset = false;
pBtnSubmit->Text = “&Start”; pLblQNum->Visible = false; pRadioOpt1->Visible = false; pRadioOpt2->Visible = false; pRadioOpt3->Visible = false;
String* pstrWelcome = m_pQuizServer->DoWelcome(“ BUDDY!”);
pstrWelcome = String::Concat(pstrWelcome, “\nPlease press Start button to start the Quiz.”);
pLblQuestion->Text = pstrWelcome; return;
}
//Uncheck all the radio buttons for the next question pRadioOpt1->set_Checked(false); pRadioOpt2->set_Checked(false);
IMPLEMENTING REMOTING |
Chapter 31 |
913 |
|
|
|
|
|
Application::Run(new CQuizForm());
return 0;
}
Testing
To test the application, you need to execute the RemoteServer application and then execute the RemoteClient application. Click on the Start button to start the quiz. Try answering the question that appears and click on the Submit button to get the next question. Figure 31-1 displays the interface of the client application.
FIGURE 31-1 The RemoteClient application
Summary
In this chapter, you have implemented a client/server application that uses .NET Remoting. The goal of Remoting is to enable coupling between two remote applications and is the .NET replacement of DCOM.
This page intentionally left blank
PARTXIIAppendixes
This page intentionally left blank
The past few years have seen the development of a plethora of proprietary software technologies. This has posed challenges for developers to develop and integrate applications and businesses to operate on. As a result, a common platform is needed that allows developers to concentrate on their work rather than bother about compatibility-related issues. Such a platform that integrates with the Internet would open unexplored avenues for business propagation. In response to the need for such a platform, Microsoft has developed the .NET Framework. Here, I’ll talk about the .NET vision and also about the design goals for develop-
ing effective business solutions using the .NET platform.
With references to .NET in newspapers, magazines, seminars, discussions, and talk shows, .NET seems to be everywhere. But what is .NET? So much emphasis on the new technology must have left you wondering just what .NET means and how you will be impacted by it. If despite the hullabaloo created about .NET you are still wondering what .NET is all about, this appendix seeks to answer most of your queries.
In this appendix, you will learn about the .NET vision and the design goals for using the .NET platform to develop solutions for the current business scenario.
The Vision Explained
The emergence of a multitude of technologies for developing applications, in turn, multiplied the challenges faced by the organizations to integrate these applications with the existing infrastructure. These requirements formed the prerequisite for the development of .NET. Microsoft’s .NET vision was to develop a common platform that provides a highly integrated and flexible base for developers and businesses. This vision aimed at the conglomeration of the Microsoft technologies to develop, deploy, and support multitier distributed applications.
Although the Windows DNA architecture was designed to facilitate the creation of distributed Web applications, it could not be used to create loosely coupled applications. Therefore, with a view to facilitate the creation of loosely coupled applications, the architecture was modified into .NET. In other words, .NET was
THE .NET VISION AND GOALS Appendix A 919
designed to provide a logical approach to developing flexible and scalable applications.
Some other benefits that the .NET Framework has to offer are the following:
A standards-based support for processing XML.
Support for the globalization and localization of resources.
A uniform platform that provides the services necessary to create enter- prise-class Web applications.
A URL-addressable resource that programmatically returns information to clients requesting it.
Ability to build components that efficiently manage data from multiple data sources and support disconnected scenarios.
Ability to interact with COM components, .NET Framework services, external type libraries, and many operating system services.
Ability to use the COM+ Services including transactions, object pooling, and queued components.
Ability to pass objects by value or by reference between distributed applications.
A programming interface to many of the protocols found on the network, such as HTTP, DNS, TCP, and UDP.
Control access to operations and resources based on policy and a set of configurable rules to determine which permissions to grant to code, based on the code’s domain, user, and assembly.
A rich programming framework for creating Win32 client applications.
Lower total cost of ownership by enabling powerful enterprise-class management of systems, applications, and devices.
Access to Active Directory from managed code.
To provide these benefits, the .NET Framework implements a distributed application model according to which a loosely coupled application is divided into three different layers or tiers:
Presentation layer
Business logic/application layer
Data access and storage layer
In the subsequent sections, I will discuss these layers in more detail.
