Remoting: A BIG TROUBLE

5 views
Skip to first unread message

Mauricio

unread,
May 14, 2003, 2:09:06 PM5/14/03
to
I have a client and a server apllication running in same
machine. When I remove the network cable from the machine,
remoting throw an error.
The server application has singleton class, that has a
method that return an object (objRef) that inherits from
MarshalByRefObject class.
The client application creates the server object and get
de objRef that has a method named GetHour().
When the client calls objRef.GetHour() with the network
cable disconnected, remoting throw an error.
Remenber that cliente and server are running in the same
machine.


Mauricio Carlos Pires

unread,
May 15, 2003, 9:42:21 AM5/15/03
to
Yes, I can send the sample code, but what is the email address?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Duke Sun

unread,
May 16, 2003, 3:54:39 AM5/16/03
to
Please attach to the post or send your mail to qua...@microsoft.com.

Best regards,
quansun
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com

Mauricio Carlos Pires

unread,
May 19, 2003, 1:12:59 PM5/19/03
to
Ok,
I did this but now I have another problem.
A remote machine running the Client program can't get the remote object.


Mauricio

Mauricio

unread,
May 19, 2003, 1:20:19 PM5/19/03
to
Ok, I did this but now the Client program running in
another machine (remote) can't get the object.

>-----Original Message-----
>I modified your sample as the following:
>1. Modify the file App.config in the server project to
register the class
>"RetClass"
><?xml version="1.0" encoding="utf-8" ?>
><configuration>
> <system.runtime.remoting>
> <application>
> <service>
> <wellknown
> type="ByRefClass.ServerClass,ByRefClass"
> objectUri="ServerUri"
> mode="Singleton"
> />
> <wellknown
> type="ByRefClass.RetClass,ByRefClass"
> objectUri="RetClass"
> mode="Singleton"
> />
> </service>
> <channels>
> <channel ref="tcp" port="8080">
> <serverProviders>
> <formatter
ref="binary"/>
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
></configuration>
>
>2. Modify the implementing code of GetNewClass() of the
class ServerClass
>as the following:
>
>Public Class ServerClass : Inherits MarshalByRefObject
> Private Shared m_val As Integer
> Private Shared m_retClass As RetClass
>
> Public Function GetNewObject() As RetClass
> If Me.m_retClass Is Nothing Then
> Me.m_retClass =
>CType(Activator.GetObject(Type.GetType
("ByRefClass.RetClass,ByRefClass"),
>"tcp://localhost:8080/RetClass"), RetClass)
> End If
> Return m_retClass
> End Function
>
>End Class
>
>After rebuild the sample, now it works fine. Please refer
to the attachment.

Duke Sun

unread,
May 19, 2003, 11:13:47 PM5/19/03
to
If you specify the IP address of a network interface card, the Media Sense
will disconnet all the connections when you unplug the cable. Therefore,
when you disconnect the cable, the IP address will not be available. That's
the cause of the error you meet.

In order to workaround the issue, you could try:
1. Disable Media Sense for TCP/IP in Windows. Please refer to the article:

http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b239924
2. Specify machineName="localhost" and useIpAddress="false" on the server
channel definition as the following:


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown
type="ByRefClass.ServerClass,ByRefClass"
objectUri="ServerUri"
mode="Singleton"
/>

</service>
<channels>
<channel ref="tcp" port="8080" machineName="localhost"
useIpAddress="false">

<serverProviders>
<formatter ref="binary"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

Best regards,

Reply all
Reply to author
Forward
0 new messages