473,725 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Guidance on remoting

Hello folks,

I appologize for the cross post, but I really need an answer on this:

I do not think that I am seeing the whole picture here. I would like to
create a windows service and a management console, using Visual Basic 2003.
The windows service part, I think, is easy enough. I am more concerned with
the remoting aspect of the project. Below is the general idea of my
approach, please correct my where I am wrong.

I would really appreciate any assistance on this, thanks.
First, let me ask some questions:

1. Why have I not seen a model that uses Delegate functions, it would seem
to be better than wrapping everything inside eventargs?

2. Must I use events to ask the server for infomation from the client?

3. Must I specify <Serializable() > on all eventargs classes?

4. What precuations must I take to prevent conflicts caused when two
clients ask to modify the same information? Say for example, a request of
the server to modify the same row in a database at the same time.

5. How do I return a value from the server?

For this illustration, lets pretend that I am creating a service that
processes tasks based on a schedule. The service would simple have a loop
that waits for work to be done:
While (Not bStop and not bPause)
'Check for tasks to perform at this time
'Create entry, task starting 'Database Log Entry
'Process the task 'Calls StartTask <-- Invokes Plug-in's Start()
'Create entry, task complete + (success value) 'Success Result is
returned by task object
'Check if task is repeating task 'Read database schedule, to see if this
is a recurring task
'Update next run time/date
Wend

Meanwhile, administrators may wish to interact with the service:

--Run Task
--Cancel Task
--Create Task
--Enable Task
--Disable Task
--Edit Task
--Delete Task
--View Task History
Assmebly: SericeRemoting. dll

Public Interface ITaskServer

Delegate Sub RunTask(ByVal TaskID As Integer)
Event OnRunTask As RunTask

Delegate Sub StopTask(ByVal TaskID As Integer)
Event OnStopTask As StopTask

Delegate Sub NewTask(ByVal TI As TaskInfo)
Event OnNewTask As NewTask

Delegate Sub DeleteTask(ByVa l TaskID As Integer)
Event OnDeleteTask As DeleteTask

Delegate Sub DisableTask(ByV al TaskID As Integer)
Event OnDisableTask As DisableTask

Delegate Sub EnableTask(ByVa l TaskID As Integer)
Event OnEnableTask As EnableTask

Delegate Sub TaskItem(ByVal TIEA As TaskInfoEventAr gs)
Event OnTaskItem As TaskItem

Delegate Sub ClearHistory(By Val TaskID As Integer)
Event OnClearHistory As ClearHistory

Delegate Sub ViewHistory(ByV al THs As TaskHistories)
Event OnViewHistory As ViewHistory

End Interface

Public Interface ITaskClient

Sub RunTask(ByVal TaskID As Integer)
Sub StopTask(ByVal TaskID As Integer)

Function NewTask(ByVal TI As TaskInfo) As Integer
Sub DeleteTask(ByVa l TaskID As Integer)

Sub DisableTask(ByV al TaskID As Integer)
Sub EnableTask(ByVa l TaskID As Integer)

Function TaskItem(ByVal TaskID As Integer) As TaskInfo
Sub EditTaskItem(By Val TI As TaskInfo)

Function ViewHistory(ByV al TaskID As Integer) As TaskHistories
Sub ClearHistory(By Val TaskID As Integer)

End Interface

Public Class RemotedObject
Implements ITaskServer
Implements ITaskClient

Public Event OnClearHistory( ByVal TaskID As Integer) Implements
ITaskServer.OnC learHistory
Public Event OnDeleteTask(By Val TaskID As Integer) Implements
ITaskServer.OnD eleteTask
Public Event OnDisableTask(B yVal TaskID As Integer) Implements
ITaskServer.OnD isableTask
Public Event OnEnableTask(By Val TaskID As Integer) Implements
ITaskServer.OnE nableTask
Public Event OnNewTask(ByVal TI As TaskInfo) Implements
ITaskServer.OnN ewTask
Public Event OnRunTask(ByVal TaskID As Integer) Implements
ITaskServer.OnR unTask
Public Event OnStopTask(ByVa l TaskID As Integer) Implements
ITaskServer.OnS topTask
Public Event OnTaskItem(ByVa l TIEA As TaskInfoEventAr gs) Implements
ITaskServer.OnT askItem
Public Event OnViewHistory(B yVal THs As TaskHistories) Implements
ITaskServer.OnV iewHistory

#Region " ITaskClient"

Public Sub ClearHistory(By Val TaskID As Integer) Implements
ITaskClient.Cle arHistory
RaiseEvent OnClearHistory( TaskID)
End Sub

Public Sub DeleteTask(ByVa l TaskID As Integer) Implements
ITaskClient.Del eteTask
RaiseEvent OnDeleteTask(Ta skID)
End Sub

Public Sub DisableTask(ByV al TaskID As Integer) Implements
ITaskClient.Dis ableTask
RaiseEvent OnDisableTask(T askID)
End Sub

Public Sub EditTaskItem(By Val TI As TaskInfo) Implements
ITaskClient.Edi tTaskItem
Dim TIEA As TaskInfoEventAr gs
TIEA = New TaskInfoEventAr gs(TI)
RaiseEvent OnTaskItem(tiea )
End Sub

Public Sub EnableTask(ByVa l TaskID As Integer) Implements
ITaskClient.Ena bleTask
RaiseEvent OnEnableTask(Ta skID)
End Sub

Public Function NewTask(ByVal TI As TaskInfo) As Integer Implements
ITaskClient.New Task
RaiseEvent OnNewTask(TI)
Return TI.TaskID
End Function

Public Sub RunTask(ByVal TaskID As Integer) Implements ITaskClient.Run Task
RaiseEvent OnRunTask(TaskI D)
End Sub

Public Sub StopTask(ByVal TaskID As Integer) Implements
ITaskClient.Sto pTask
RaiseEvent OnStopTask(Task ID)
End Sub

Public Function TaskItem(ByVal TaskID As Integer) As TaskInfo Implements
ITaskClient.Tas kItem
Dim TIEA As TaskInfoEventAr gs
TIEA = New TaskInfoEventAr gs(TaskID)
RaiseEvent OnTaskItem(TIEA )

Return TIEA.TaskInfo

End Function

Public Function ViewHistory(ByV al TaskID As Integer) As TaskHistories
Implements ITaskClient.Vie wHistory
Dim THs As TaskHistories
THs = New TaskHistories(T askID)
RaiseEvent OnViewHistory(T Hs)
Return THs
End Function

#End Region

End Class

Assmebly: ClientConsole.e xe
'Code truncated for brevity

Public Class ClientConsumer

Private mRemoteService As ITaskClient

Private Delegate Sub ClearHistoryDel egate(ByVal TaskID As Integer)
Private Delegate Function NewTaskDelegate (ByVal TaskInfo As TaskInfo) As
Integer

Public Sub New()
Dim ServerPort As Integer = 5555
ChannelServices .RegisterChanne l(New TcpChannel)
mRemoteService =
Activator.GetOb ject(GetType(Se riceRemoting.Re motedObject),
String.Format(" tcp://localhost:{0}/RemotedObject", ServerPort.ToSt ring))
End Sub

Public Sub ClearHistory(By Val TaskID As Integer)

Dim cb As AsyncCallback = New AsyncCallback(A ddressOf ClearHistoryBac k)
Dim d As ClearHistoryDel egate = New ClearHistoryDel egate(AddressOf
mRemoteService. ClearHistory)
Dim ar As IAsyncResult = d.BeginInvoke(T askID, cb, Nothing)

End Sub

Private Sub ClearHistoryBac k(ByVal ar As IAsyncResult)
Dim d As ClearHistoryDel egate = CType((CType(ar ,
System.runtime. Remoting.Messag ing.AsyncResult )).AsyncDelegat e,
ClearHistoryDel egate)

Try
d.EndInvoke(ar)
Trace.WriteLine ("Success for Clear History")
Catch ex As Exception
Trace.WriteLine (ex.ToString)
End Try

End Sub

Public Function NewTask(ByVal TaskInfo As TaskInfo) As Integer

Dim cb As AsyncCallback = New AsyncCallback(A ddressOf NewTaskBack)
Dim d As NewTaskDelegate = New NewTaskDelegate (AddressOf
mRemoteService. NewTask)
Dim ar As IAsyncResult = d.BeginInvoke(T askInfo, cb, Nothing)

'how do I return the value?

End Function

Public Sub NewTaskBack(ByV al ar As IAsyncResult)

Dim d As NewTaskDelegate = CType((CType(ar ,
System.runtime. Remoting.Messag ing.AsyncResult )).AsyncDelegat e,
NewTaskDelegate )

Try
d.EndInvoke(ar)
Trace.WriteLine ("Success for new task")
' How do I return the value?
'
'
Catch ex As Exception
Trace.WriteLine (ex.ToString)
End Try

End Sub

End Class

Jan 16 '06 #1
6 1624
I know you folks are busy making your own dime, but if you could give me
some time I would appreciate it.
Thanks very much.
"AMDRIT" <am****@hotmail .com> wrote in message
news:Op******** ******@TK2MSFTN GP09.phx.gbl...
Hello folks,

I appologize for the cross post, but I really need an answer on this:

I do not think that I am seeing the whole picture here. I would like to
create a windows service and a management console, using Visual Basic
2003. The windows service part, I think, is easy enough. I am more
concerned with the remoting aspect of the project. Below is the general
idea of my approach, please correct my where I am wrong.

I would really appreciate any assistance on this, thanks.
First, let me ask some questions:

1. Why have I not seen a model that uses Delegate functions, it would
seem to be better than wrapping everything inside eventargs?

2. Must I use events to ask the server for infomation from the client?

3. Must I specify <Serializable() > on all eventargs classes?

4. What precuations must I take to prevent conflicts caused when two
clients ask to modify the same information? Say for example, a request of
the server to modify the same row in a database at the same time.

5. How do I return a value from the server?

For this illustration, lets pretend that I am creating a service that
processes tasks based on a schedule. The service would simple have a loop
that waits for work to be done:
While (Not bStop and not bPause)
'Check for tasks to perform at this time
'Create entry, task starting 'Database Log Entry
'Process the task 'Calls StartTask <-- Invokes Plug-in's Start()
'Create entry, task complete + (success value) 'Success Result is
returned by task object
'Check if task is repeating task 'Read database schedule, to see if
this is a recurring task
'Update next run time/date
Wend

Meanwhile, administrators may wish to interact with the service:

--Run Task
--Cancel Task
--Create Task
--Enable Task
--Disable Task
--Edit Task
--Delete Task
--View Task History
Assmebly: SericeRemoting. dll

Public Interface ITaskServer

Delegate Sub RunTask(ByVal TaskID As Integer)
Event OnRunTask As RunTask

Delegate Sub StopTask(ByVal TaskID As Integer)
Event OnStopTask As StopTask

Delegate Sub NewTask(ByVal TI As TaskInfo)
Event OnNewTask As NewTask

Delegate Sub DeleteTask(ByVa l TaskID As Integer)
Event OnDeleteTask As DeleteTask

Delegate Sub DisableTask(ByV al TaskID As Integer)
Event OnDisableTask As DisableTask

Delegate Sub EnableTask(ByVa l TaskID As Integer)
Event OnEnableTask As EnableTask

Delegate Sub TaskItem(ByVal TIEA As TaskInfoEventAr gs)
Event OnTaskItem As TaskItem

Delegate Sub ClearHistory(By Val TaskID As Integer)
Event OnClearHistory As ClearHistory

Delegate Sub ViewHistory(ByV al THs As TaskHistories)
Event OnViewHistory As ViewHistory

End Interface

Public Interface ITaskClient

Sub RunTask(ByVal TaskID As Integer)
Sub StopTask(ByVal TaskID As Integer)

Function NewTask(ByVal TI As TaskInfo) As Integer
Sub DeleteTask(ByVa l TaskID As Integer)

Sub DisableTask(ByV al TaskID As Integer)
Sub EnableTask(ByVa l TaskID As Integer)

Function TaskItem(ByVal TaskID As Integer) As TaskInfo
Sub EditTaskItem(By Val TI As TaskInfo)

Function ViewHistory(ByV al TaskID As Integer) As TaskHistories
Sub ClearHistory(By Val TaskID As Integer)

End Interface

Public Class RemotedObject
Implements ITaskServer
Implements ITaskClient

Public Event OnClearHistory( ByVal TaskID As Integer) Implements
ITaskServer.OnC learHistory
Public Event OnDeleteTask(By Val TaskID As Integer) Implements
ITaskServer.OnD eleteTask
Public Event OnDisableTask(B yVal TaskID As Integer) Implements
ITaskServer.OnD isableTask
Public Event OnEnableTask(By Val TaskID As Integer) Implements
ITaskServer.OnE nableTask
Public Event OnNewTask(ByVal TI As TaskInfo) Implements
ITaskServer.OnN ewTask
Public Event OnRunTask(ByVal TaskID As Integer) Implements
ITaskServer.OnR unTask
Public Event OnStopTask(ByVa l TaskID As Integer) Implements
ITaskServer.OnS topTask
Public Event OnTaskItem(ByVa l TIEA As TaskInfoEventAr gs) Implements
ITaskServer.OnT askItem
Public Event OnViewHistory(B yVal THs As TaskHistories) Implements
ITaskServer.OnV iewHistory

#Region " ITaskClient"

Public Sub ClearHistory(By Val TaskID As Integer) Implements
ITaskClient.Cle arHistory
RaiseEvent OnClearHistory( TaskID)
End Sub

Public Sub DeleteTask(ByVa l TaskID As Integer) Implements
ITaskClient.Del eteTask
RaiseEvent OnDeleteTask(Ta skID)
End Sub

Public Sub DisableTask(ByV al TaskID As Integer) Implements
ITaskClient.Dis ableTask
RaiseEvent OnDisableTask(T askID)
End Sub

Public Sub EditTaskItem(By Val TI As TaskInfo) Implements
ITaskClient.Edi tTaskItem
Dim TIEA As TaskInfoEventAr gs
TIEA = New TaskInfoEventAr gs(TI)
RaiseEvent OnTaskItem(tiea )
End Sub

Public Sub EnableTask(ByVa l TaskID As Integer) Implements
ITaskClient.Ena bleTask
RaiseEvent OnEnableTask(Ta skID)
End Sub

Public Function NewTask(ByVal TI As TaskInfo) As Integer Implements
ITaskClient.New Task
RaiseEvent OnNewTask(TI)
Return TI.TaskID
End Function

Public Sub RunTask(ByVal TaskID As Integer) Implements
ITaskClient.Run Task
RaiseEvent OnRunTask(TaskI D)
End Sub

Public Sub StopTask(ByVal TaskID As Integer) Implements
ITaskClient.Sto pTask
RaiseEvent OnStopTask(Task ID)
End Sub

Public Function TaskItem(ByVal TaskID As Integer) As TaskInfo Implements
ITaskClient.Tas kItem
Dim TIEA As TaskInfoEventAr gs
TIEA = New TaskInfoEventAr gs(TaskID)
RaiseEvent OnTaskItem(TIEA )

Return TIEA.TaskInfo

End Function

Public Function ViewHistory(ByV al TaskID As Integer) As TaskHistories
Implements ITaskClient.Vie wHistory
Dim THs As TaskHistories
THs = New TaskHistories(T askID)
RaiseEvent OnViewHistory(T Hs)
Return THs
End Function

#End Region

End Class

Assmebly: ClientConsole.e xe
'Code truncated for brevity

Public Class ClientConsumer

Private mRemoteService As ITaskClient

Private Delegate Sub ClearHistoryDel egate(ByVal TaskID As Integer)
Private Delegate Function NewTaskDelegate (ByVal TaskInfo As TaskInfo) As
Integer

Public Sub New()
Dim ServerPort As Integer = 5555
ChannelServices .RegisterChanne l(New TcpChannel)
mRemoteService =
Activator.GetOb ject(GetType(Se riceRemoting.Re motedObject),
String.Format(" tcp://localhost:{0}/RemotedObject", ServerPort.ToSt ring))
End Sub

Public Sub ClearHistory(By Val TaskID As Integer)

Dim cb As AsyncCallback = New AsyncCallback(A ddressOf ClearHistoryBac k)
Dim d As ClearHistoryDel egate = New ClearHistoryDel egate(AddressOf
mRemoteService. ClearHistory)
Dim ar As IAsyncResult = d.BeginInvoke(T askID, cb, Nothing)

End Sub

Private Sub ClearHistoryBac k(ByVal ar As IAsyncResult)
Dim d As ClearHistoryDel egate = CType((CType(ar ,
System.runtime. Remoting.Messag ing.AsyncResult )).AsyncDelegat e,
ClearHistoryDel egate)

Try
d.EndInvoke(ar)
Trace.WriteLine ("Success for Clear History")
Catch ex As Exception
Trace.WriteLine (ex.ToString)
End Try

End Sub

Public Function NewTask(ByVal TaskInfo As TaskInfo) As Integer

Dim cb As AsyncCallback = New AsyncCallback(A ddressOf NewTaskBack)
Dim d As NewTaskDelegate = New NewTaskDelegate (AddressOf
mRemoteService. NewTask)
Dim ar As IAsyncResult = d.BeginInvoke(T askInfo, cb, Nothing)

'how do I return the value?

End Function

Public Sub NewTaskBack(ByV al ar As IAsyncResult)

Dim d As NewTaskDelegate = CType((CType(ar ,
System.runtime. Remoting.Messag ing.AsyncResult )).AsyncDelegat e,
NewTaskDelegate )

Try
d.EndInvoke(ar)
Trace.WriteLine ("Success for new task")
' How do I return the value?
'
'
Catch ex As Exception
Trace.WriteLine (ex.ToString)
End Try

End Sub

End Class


Jan 16 '06 #2
"AMDRIT" <am****@hotmail .com> wrote in message
news:Op******** ******@TK2MSFTN GP09.phx.gbl...
I do not think that I am seeing the whole picture here. I would like to
create a windows service and a management console, using Visual Basic
2003. The windows service part, I think, is easy enough. I am more
concerned with the remoting aspect of the project.


OK I saw your plea...

One approach is to create a singleton object on the server that is exposed
via Remoting. It is this object that is used to interact with the service.

Assuming that the service is running, a Remoting client then attaches to the
singleton to access its methods and properties. If you desire to receive
events from the service (via the singleton), the roles are swapped and the
client that receives the event becomes the server in that scenario, and the
service becomes the client. It's somewhat confusing and has ramifications
on where your interface is defined (should be in a separate shared
assembly).

Let me know if you have specific questions about this approach. I'm sorry I
did not take the time to study your source code that you posted.

-- Alan
Jan 16 '06 #3
Thank you for the response.

I have amended my code to speak directly with the issues that concern me the
most.

First I have made this a synchronous sample, I will get to async when I am
ready. I have much to learn first. I am striving towards a solution where
the client requests updates and illicites responses, I do not plan to have
the server push anything unsolicited to the client.

The remoted object has two methods
Sub Announce(Messag e as string)
Function Add(Int1 as integer, Int2 as integer) as integer

The client will ask for the server to announce a message or add two integers

The server will trace.writeline a message from OnAnnounce event
The server will Return the sum of the OnAdd event

Questions

1. Does the following code speak to your outline of client side requests.
2. How am I to properly clean up the remoted object on both the client and
server.
3. How many concurrent connections does this model support. (3.b I only
plan to need 2, but how will I know what I have?)
4. Do I have to do anything with lifetime tickets?
5. Am I supposed to use eventargs each time I pass data in a method or
function
7. If I have 2 connections attempting to modify a server side value, do I
simply use sync lock, or does it inherently queue requests.
8. Is it possible for the client to time out on a request, can I set the
value or capture the exception?

I think this would be enough to get me going.

'Singleton object that is stored in a common assembly
Class MySingleton
Inherits MarshalByRefObj ect

Public Event OnAnnounce(ByVa l Message As String)
Public Event OnAdd(ByVal e As MathAddArgs)

Public Sub Announce(ByVal Message As String)
RaiseEvent OnAnnounce(Mess age)
End Sub

Public Function Add(ByVal Int1 As Integer, ByVal Int2 As Integer) As
Integer
Dim e As MathAddArgs

e = New MathAddArgs(Int 1, Int2)
RaiseEvent OnAdd(e)

Return e.Sum

End Function

End Class

'Event arguments for adding two integers
'part of the shared assembly
<Serializable() >Public Class MathAddArgs
Inherits System.EventArg s

Private mint1 As Integer
Private mint2 As Integer

Private msum As Integer

Public Sub New(ByVal Int1 As Integer, ByVal Int2 As Integer)
mint1 = Int1
mint2 = Int2
End Sub

Public ReadOnly Property Int1() As Integer
Get
Return mint1
End Get
End Property

Public ReadOnly Property Int2() As Integer
Get
Return mint2
End Get
End Property

Public ReadOnly Property Sum() As Integer
Get
Return msum
End Get
End Property

Public Sub SetSum(ByVal Value As Integer)
msum = Value
End Sub

End Class

'Client Assembly, interacts with the service via MySingleton
Class TestClient

Private mRemoted As MySingleton

Public Sub New()
ChannelServices .RegisterChanne l(New TcpChannel)
mRemoted = Activator.GetOb ject(GetType(My Singleton),
"tcp://myserver:8084/MySingleton")
End Sub

Public Function ServerAdd(ByVal int1 As Integer, ByVal Int2 As Integer) As
Integer
Return mRemoted.Add(in t1, Int2)
End Function

Public Sub ServerAnnounce( ByVal Message As String)
mRemoted.Announ ce(Message)
End Sub

Protected Overrides Sub Finalize()
mRemoted = Nothing
MyBase.Finalize ()
End Sub
End Class

'Performs methods and functions based on calls from the client via
MySingleton
Class TestService

Private mRemoted As MySingleton

Public Sub New()
Dim refClient As ObjRef

ChannelServices .RegisterChanne l(New TcpChannel(8084 ))
mRemoted = New MySingleton

refClient = RemotingService s.Marshal(mRemo ted, "MySingleto n")

AddHandler mRemoted.OnAdd, AddressOf Singleton_Add
AddHandler mRemoted.OnAnno unce, AddressOf Singleton_Annou nce
End Sub

Private Sub Singleton_Add(B yVal e As MathAddArgs)
e.SetSum(e.Int1 + e.Int2)
End Sub

Private Sub Singleton_Annou nce(ByVal Message As String)
Trace.WriteLine (String.Format( "message from some client is: {0}",
Message))
End Sub

Protected Overrides Sub Finalize()

RemoveHandler mRemoted.OnAdd, AddressOf Singleton_Add
RemoveHandler mRemoted.OnAnno unce, AddressOf Singleton_Annou nce

MyBase.Finalize ()

End Sub
End Class
"Alan Pretre" <no@spam> wrote in message
news:%2******** *******@TK2MSFT NGP14.phx.gbl.. .
"AMDRIT" <am****@hotmail .com> wrote in message
news:Op******** ******@TK2MSFTN GP09.phx.gbl...
I do not think that I am seeing the whole picture here. I would like to
create a windows service and a management console, using Visual Basic
2003. The windows service part, I think, is easy enough. I am more
concerned with the remoting aspect of the project.


OK I saw your plea...

One approach is to create a singleton object on the server that is exposed
via Remoting. It is this object that is used to interact with the
service.

Assuming that the service is running, a Remoting client then attaches to
the singleton to access its methods and properties. If you desire to
receive events from the service (via the singleton), the roles are swapped
and the client that receives the event becomes the server in that
scenario, and the service becomes the client. It's somewhat confusing and
has ramifications on where your interface is defined (should be in a
separate shared assembly).

Let me know if you have specific questions about this approach. I'm sorry
I did not take the time to study your source code that you posted.

-- Alan

Jan 16 '06 #4
"AMDRIT" <am****@hotmail .com> wrote in message
news:eW******** ******@TK2MSFTN GP14.phx.gbl...
1. Does the following code speak to your outline of client side requests.
Before we get too far, the service's OnStart() routine is the one that
should register and instantiate the singleton, using
System.Runtime. Remoting.Remoti ngConfiguration .RegisterWellKn ownServiceType( ),
and System.Activato r.GetObject().

There is no need to use events/eventargs as you show in your code. Simply
expose public methods and properties in the singleton.
2. How am I to properly clean up the remoted object on both the client
and server.
If you make the singleton a component, by deriving it from
System.Componen tModel.Componen t, you can supply a Dispose() routine that can
be called from the service's OnStop(). This will also give you a canvas for
dropping on other components in VS such as timers, etc.
3. How many concurrent connections does this model support. (3.b I only
plan to need 2, but how will I know what I have?)
Should be OK. Haven't actually tested this myself.
4. Do I have to do anything with lifetime tickets?
If your singleton is a component, then you can override the
InitializeLifet imeServices() method to setup the lifetime as needed.
Returning null will have infinite lifetime.
5. Am I supposed to use eventargs each time I pass data in a method or
function
Not needed. See above.
7. If I have 2 connections attempting to modify a server side value, do I
simply use sync lock, or does it inherently queue requests.
Yes, you will need to synchronize access.
8. Is it possible for the client to time out on a request, can I set the
value or capture the exception?


Yes, you must be able to handle Remoting exceptions in all calls through the
Remoting proxy.

-- Alan
Jan 16 '06 #5
Alan,

Thank you for the responses, I really do appreciate it. I do have a follow
up question though; if I derive this from System.Componen tModel.Componen t,
how can I also inherit MarshalByRefObj ?
"Alan Pretre" <no@spam> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
"AMDRIT" <am****@hotmail .com> wrote in message
news:eW******** ******@TK2MSFTN GP14.phx.gbl...
1. Does the following code speak to your outline of client side
requests.


Before we get too far, the service's OnStart() routine is the one that
should register and instantiate the singleton, using
System.Runtime. Remoting.Remoti ngConfiguration .RegisterWellKn ownServiceType( ),
and System.Activato r.GetObject().

There is no need to use events/eventargs as you show in your code. Simply
expose public methods and properties in the singleton.
2. How am I to properly clean up the remoted object on both the client
and server.


If you make the singleton a component, by deriving it from
System.Componen tModel.Componen t, you can supply a Dispose() routine that
can be called from the service's OnStop(). This will also give you a
canvas for dropping on other components in VS such as timers, etc.
3. How many concurrent connections does this model support. (3.b I only
plan to need 2, but how will I know what I have?)


Should be OK. Haven't actually tested this myself.
4. Do I have to do anything with lifetime tickets?


If your singleton is a component, then you can override the
InitializeLifet imeServices() method to setup the lifetime as needed.
Returning null will have infinite lifetime.
5. Am I supposed to use eventargs each time I pass data in a method or
function


Not needed. See above.
7. If I have 2 connections attempting to modify a server side value, do
I simply use sync lock, or does it inherently queue requests.


Yes, you will need to synchronize access.
8. Is it possible for the client to time out on a request, can I set the
value or capture the exception?


Yes, you must be able to handle Remoting exceptions in all calls through
the Remoting proxy.

-- Alan

Jan 17 '06 #6
"AMDRIT" <am****@hotmail .com> wrote in message
news:e7******** ******@TK2MSFTN GP10.phx.gbl...
if I derive this from System.Componen tModel.Componen t, how can I also
inherit MarshalByRefObj ?


Ah. A Component is a MBR object!

See:
http://msdn.microsoft.com/library/de...classtopic.asp

-- Alan
Jan 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1906
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS Remoting and possible others. Keywords: VSS Remote Access, VSS Web Access, VSS Internet Access,
5
5687
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere 4.0, SourceOffSite 4.1, VSS Connect 1.5, SourceXT 2.1, VSS Remoting 2.5,
0
3291
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS Remoting and possible others.
11
5307
by: Ken Durden | last post by:
I am in search of a comprehensive methodology of using these two object cleanup approaches to get rid of a number of bugs, unpleasantries, and cleanup-ordering issues we currently have in our 4-month old C#/MC++ .NET project project. I'd like to thank in advance anyone who takes the time to read and/or respond to this message. At a couple points, it may seem like a rant against C# / .NET, but we are pretty firmly stuck with this approach...
0
1420
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS Remoting and possible others. Keywords: VSS Remote Access, VSS Web Access, VSS Internet Access,
0
2460
by: Martijn Damen | last post by:
Hi, At the moment I am trying to develop an application that uses another app over .net remoting and having some problems with it (ok, that is ofcourse why I am here), hope somebody can shine a light on the following: I have been given a sample winforms app, which works without problem, I can connect, send queries and become response from the other application. When I try to implement this in webforms, this unfortunately does not...
8
1752
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged package) to .NET. Our clients have been asking for lot of new stuff namely being able to send patient information to devices, being able to fix appointments online, etc.
1
1492
by: test.file | last post by:
I'd like to implement QueueUserWorkItem for some parts of the app; specifically for DB related caching and file i/o. Example: When the user finishes work on a file, I'd like to process the file persistence (some data to db + file system as zip) in the background. I haven't worked with ThreadPool before so am asking for ideas/guidance for implementation. On the client side (WinForm), I'm likely to be remoting for some db cache...
6
1049
by: AMDRIT | last post by:
Hello folks, I appologize for the cross post, but I really need an answer on this: I do not think that I am seeing the whole picture here. I would like to create a windows service and a management console, using Visual Basic 2003. The windows service part, I think, is easy enough. I am more concerned with the remoting aspect of the project. Below is the general idea of my approach, please correct my where I am wrong.
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.