Updating remote properties

kejpa

Well-known member
Joined
Oct 10, 2003
Messages
320
Hi,
I have a server app (eventually running as a service) that will listen on some COM-ports and makeing calculations based on data recieved.
Calculations can have different parameters which I want to be able to change from the Client App that can be run both from the local machine or from a networked computer (no firewalls in between).

Which is the best way to implement this, in VB6 we used DCOM (with much headache during setup).
Some basic samples would be nice too ;)

TIA
/Kejpa
 
I thought so too, but I havent been able to find any suitable samples.
Anyone have samples to point to or share?

TIA
/Kejpa
 
OK,
so I found .NET remoting in simple english and it got me going a bit.

Ill have a class library with a messenger class.
I think I will make a Public Event for setting different server properties having different server classes add handlers for it.
What Im not so sure about is how to get the server classes properties. How should the client get the settings? I guess Id better make it asyncronous, but Im not sure how to make it.

One of the classes I like to communicate with is CommPorts 3 which is a part of a CommPorts collection class containing all the existing ports on the computer. It has a Properties-property for all its settings which I would like to get and set from my remote client.
Another one is a Device called BP which is a part of a Devices collection class with a string identifyer

This is as far as Im currently...
Code:
Public Class cHermes
    Inherits MarshalByRefObject

    Public Delegate Sub UpdatedPropertyHandler(ByVal sender As Object, ByVal e As UpdatedPropertyEventArgs)
    Public Delegate Function ObjectPropertyDelegate(ByVal Identifyer As String) As IAsyncResult

    Public Event UpdatedPropertyEvent As UpdatedPropertyHandler

    Public Overrides Function InitializeLifetimeService() As Object
        This function, if overriden, allows us to tell the Manager object how long
        it should live. If by any reason wed like to have it stay a lil longer, we renew it and so forth
        We wont do anything here. So what happens is that 
        the Manager object is governed by a default lifetime.
        Return Nothing
    End Function

    Public Function GetCommPortProperties(ByVal CommPort As Short) As ObjectPropertyDelegate
        ...
    End Function
    Public Sub SetCommPortProperties(ByVal CommPort As Short, ByVal Properties As Specialized.ListDictionary)
        ...
    End Sub

    Public Function GetDeviceProperties(ByVal Devicename As String) As ObjectPropertyDelegate
        ...
    End Function
    Public Sub SetDeviceProperties(ByVal Device As String, ByVal Properties As Specialized.ListDictionary)
        ...
    End Sub

End Class

Public Class UpdatedPropertyEventArgs
    Inherits EventArgs

    Private _Identifyer As Object
    Private _Properties As Specialized.ListDictionary

    Public Sub New(ByVal Identifyer As Object, ByVal Properties() As DictionaryEntry)
        _Identifyer = Identifyer
        _Properties = New Specialized.ListDictionary
        For Each itm As DictionaryEntry In Properties
            _Properties.Add(itm.Key, itm.Value)
        Next
    End Sub
    Public Sub New(ByVal Identifyer As Object, ByVal Properties As Specialized.ListDictionary)
        _Identifyer = Identifyer
        _Properties = Properties
    End Sub

End Class

Any help appreciated!
/Kejpa
 
Alright,
new approach, my last post on this issue didnt help me out much :(

Ive created the attached solution, a random generator server which should be called from a remote client through some inbetween manager which raises events when a request comes and another when the random has been generated.

When I run the client (after the server been started) I get the following message:
[Broken External Image]:http://www.computerhelp.forum/attachment.php?attachmentid=5416&stc=1

Any help appreciated
/Kejpa
 

Attachments

Back
Top