kejpa Posted December 28, 2005 Posted December 28, 2005 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 Quote
Administrators PlausiblyDamp Posted December 30, 2005 Administrators Posted December 30, 2005 Under .Net either remoting or web services are the easist ways to go. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
kejpa Posted January 2, 2006 Author Posted January 2, 2006 I thought so too, but I haven't been able to find any suitable samples. Anyone have samples to point to or share? TIA /Kejpa Quote
kejpa Posted January 2, 2006 Author Posted January 2, 2006 OK, so I found .NET remoting in simple english and it got me going a bit. I'll 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 I'm not so sure about is how to get the server classes properties. How should the client get the settings? I guess I'd better make it asyncronous, but I'm 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 it's 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 I'm currently... 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 we'd like to have it stay a 'lil longer, we renew it and so forth 'We won't 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 Quote
kejpa Posted January 16, 2006 Author Posted January 16, 2006 Alright, new approach, my last post on this issue didn't help me out much :( I've 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: http://www.xtremedotnettalk.com/attachment.php?attachmentid=5416&stc=1 Any help appreciated /KejpaCliServ.zip Quote
Recommended Posts