Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

How- Client Server Using VB.Net (Part 3)

Author: DevASP
Download Source Code : 545_Server.zip

In This Article we will discuss the server side Methods. This Article is designed to show how to use the .NET Remoting architecture using three types of remote objects.

This Article is designed to show how to use the .NET Remoting architecture using three types of remote objects. In addition, it uses XML configuration files to specify available objects and server location information instead of hard-coding them into the binaries or putting the data into the system registry.

To make it easier to configure, each class lives in the same namespace, RemotingSample, which is defined in each class source file. Note, that each class exposes a set of debug properties to help you verify that the object is in fact running from another location (specifically the DebugCodeBase property).

In Server Project I Include three classes Named as

1-Customer

2-SingleCallCustomer

3-SingleTonCustomer

First Important Methods of Customers to be discuss

Accept changes to the Name & Age and return the values as a string, Update local properties and Do some work here like update a database (an exercise for the reader).

 

Public Function UpdateCustomerInfo(ByVal NewName As String, ByVal NewAge As Byte) As String

            Me.Name = NewName

            Me.Age = NewAge

Return String.Format("Customer Name is {0}. Customer Age is {1}", Me.Name, Me.Age)

End Function

 

The following properties are for getting information about the component for testing purposes only. Some information is retrieved using the assemblyInfo class (defined in the AssemblyInfo.vb file). All the members are decorated with the Debug keyword to designate their

testing status and to make them easy to find in IntelliSense. The CodeBase will return the physical path from which the component is running.

 

Public ReadOnly Property DebugCodeBase() As String

                  Get

                        Dim ainfo As New AssemblyInfo()

                        Return ainfo.CodeBase

                  End Get

End Property

Returns the assembly's fully qualified name.

 

Public ReadOnly Property DebugFQName() As String

            Get

                  Dim ainfo As New AssemblyInfo()

                  Return ainfo.AsmFQName

      End Get

End Property

Now Important Methods of SingleCallCustomer to be discuss.

Accept changes to the Name & Age and return the values as a string

Update local properties. Do some work here like update a database (an exercise for the reader).

 

Public Function UpdateCustomerInfo(ByVal NewName As String, ByVal NewAge As Byte) As String

                  Me.Name = NewName

                  Me.Age = NewAge

Return String.Format("Customer Name is {0}. Customer Age is {1}", Me.Name, Me.Age)

End Function 

 

The following properties are for getting information about the component for testing purposes only. Some information is retrieved using the AssemblyInfo class (defined in the AssemblyInfo.vb file). All the members are decorated with the Debug keyword to designate their

testing status and to make them easy to find in IntelliSense. The CodeBase will return the physical path from which the component is running.

 

Public ReadOnly Property DebugCodeBase() As String

            Get

                  Dim ainfo As New AssemblyInfo()

                  Return ainfo.CodeBase

            End Get

End Property

 

This routine Returns the name of the machine that the object is running on.

Public ReadOnly Property DebugHostName() As String

            Get

                  Return System.Environment.MachineName

            End Get

End Property

Now Important Methods of SingleTonCustomer to be discuss.This function infact return Property implementation for Name.

Public Property Name() As String

            Get

                Return m_Name

            End Get

            Set(ByVal Value As String)

                m_Name = Value

            End Set

End Property

 This function Returns the assembly's fully qualified name

 Public ReadOnly Property DebugFQName() As String

           Get

               Dim ainfo As New AssemblyInfo

               Return ainfo.AsmFQName

           End Get

 End Property

Instructions for Running the Sample

Before running the demo, you need to build all three projects. You should build them in this order:

  1. RemoteCustomer
  2. Host
  3. Client

Once the binaries have been build, you will need to start the Host application first to make sure your objects are available for remoting. Next start your client.

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How we can make Custom Color Form in VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net