Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

  • 2 weeks later...
Posted

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

/Kejpa

CliServ.zip

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...