Hey ho,
This is a question that I have already posted, but received no valuable
anser... So maybe I have more luck this time :-)
I have a (hopefully) little problem with remoting:
I'm currently developing an application (VB.NET) which should execute
some methods on a different client within the LAN. So I wrote this
little piece of code for testing purposes:
Public Class RemoteObject
Inherits MarshalByRefObject
Function Show() As String
Return "test"
End Function
End Class
Public Class RemotingServer
Sub New()
Dim provider As New BinaryServerFormatterSinkProvider()
Dim client As New BinaryClientFormatterSinkProvider()
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
Dim props As Collections.IDictionary
props = New Hashtable()
props.Add("port", "1234")
Dim serverchannel As TcpChannel(props, client, provider)
ChannelServices.RegisterChannel(serverchannel, True)
Dim oType As System.Type = (New RemoteObject).GetType
Remoting.RemotingConfiguration.RegisterWellKnownServiceType(oType, _
"RemoteObject.Soap",
Remoting.WellKnownObjectMode.Singleton)
End Sub
Sub checkClient()
Dim oType As System.Type = (New RemoteObject).GetType
Dim obj As RemoteObject = CType(Activator.GetObject
(oType, "tcp://localhost:1234/RemoteObject.soap"),
RemoteObject)
MessageBox.Show(obj.Show)
End Sub
End Class
This works fine until I change 'localhost' to a name of a 'real' client
- Then I get an error which says that the connection has been refused.
So what I want is this: checkClient() should execute the method .Show()
on the client
Can anybody help me to correct and improve my code???
Thanx
Norman