[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Ken Kolda

8/20/2004 2:59:00 PM

It sounds like your client isn't able to connect to your server (e.g.
server's not running, using the wrong port, firewall blocking the
connection, etc.). In your code you're checking the return value of
GetObject() to see if it's Nothing, but that won't help -- the call to
GetObject() doesn't actually connect to the server. The connection occurs on
the first call into that object, which is why you'll get the exception on
the call to Add().

Ken


".NetHelpWanted" <sasijrao@gmail.com> wrote in message
news:4A911CE3-01DD-4975-8335-8A0E6CEAC2C9@microsoft.com...
> I have a client
> the code I have
> Public Sub callremote()
> Try
>
>
> Dim chan As TcpChannel = New TcpChannel
> ChannelServices.RegisterChannel(chan)
> Dim calc As New Calculator
> ' calc =
(Activator.GetObject(Type.GetType(RemoteObject.Calculator),
> "tcp://localhost:8085/RemoteObject.Calculator"),Calculator)
> calc = Activator.GetObject(GetType(RemoteObject.Calculator),
> "tcp://nt82:6666/RemoteObject.Calculator")
> If calc Is Nothing Then
> System.Console.WriteLine("Could not locate server")
> Else
>
> MsgBox(calc.Add(4, 13))
> End If
> Catch ex As Exception
> MsgBox(ex.Message + "--" + ex.StackTrace)
> End Try
> End Sub
>
> The Remoteobject has this code
>
> Public Class Calculator
> Inherits MarshalByRefObject
> Public Function Add(ByVal operand1 As Integer, ByVal operand2 As
> Integer) As Integer
> Return operand1 + operand2
> End Function
>
>
> End Class
>
>
> When Ic all the remote object it gives me error the following error
>
> Any one has an suggestions?
>
>
> Server stack trace:
> at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
> at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
> at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
> at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String
> machineAndPort)
> at
>
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithR
etry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
> at
>
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(I
Message
> msg, ITransportHeaders requestHeaders, Stream requestStream,
> ITransportHeaders& responseHeaders, Stream& responseStream)
> at
>
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessag
e(IMessage msg)
>
> Exception rethrown at [0]:
> at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg)
> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type)
> at RemoteObject.Calculator.Add(Int32 operand1, Int32 operand2) in
> D:\SasiWorking\Remoting\RemoteObject\Calculator.vb:line 4
> at RemotingClient.Form1.callremote() in
> D:\SasiWorking\Remoting\RemotingClient\Form1.vb:line 74"
> --
> .NetHelpWanted