![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello there, I've scoured the web for a couple of hours now trying to find a solution to my problem so I am going to resort to asking the wider world for assistance. I'm sure it's going to be a simple thing but I just cant make it work. Consider the following server activation code Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.http Imports CommonCode Public Module rPhoneServer Dim strSite As String = String.Empty Sub Main() If GetParamValue("Site", strSite) = 1 Then RemotingConfiguration.Configure("rPhoneServer.exe. config", False) Dim MyServerObj As New CommonCode.rPhone MyServerObj.Startup(strSite) MyServerObj.Site = strSite Console.WriteLine("Starting Server. HashCode = " & MyServerObj.GetHash) Console.WriteLine() Console.WriteLine("Press any key to exit...") MyServerObj.StartProcessing() Else Console.WriteLine("Main:: No site specified on command line (/site , Exiting")End If End Sub End Module The remote object looks like this Public Class rPhone Inherits MarshalByRefObject Public Declare Function Sleep Lib "Kernel32" (ByVal Milliseconds As Integer) As Integer Shared strSite As String ..... etc .... Now on the client with code Public Function Startup() As Integer RemotingConfiguration.Configure("rPhoneClient.exe. config", False) CommoncodeRPhone = New CommonCode.rPhone ... etc ... When I run MsgBox(CommoncodeRPhone.Site) I get a blank string "" rather than "TDOC" which is set back in MyServerObj.Startup(strSite) MyServerObj.Site = strSite i know that strsite is holding the value "TDOC" because I debug through it and I can see it setting it, just as I can have a function running in the server console app that just prints the value of Site and it prints "TDOC" every time, but on the client it prints nothing. Just to make sure I was referring to the same object I created Public Function GetHash() As String Return Me.GetType.GetHashCode.ToString End Function In the remotable class and sure enough it returns the same value on the server and on the client. I can post more files should you require more information (or the entire solution if need be) Can someone please tell me what I am doing wrong, as If I set Site on the server.... when I query the site property on the clients I want it to reflect the same value, which I thought was the whole idea of a singleton implementation? Cheers, Aaron |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |