Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new TcpServerChannel throws "No such host is known"

Status
Not open for further replies.

Milby7

Programmer
Dec 5, 2003
67
GB
Hi!

I've got a windows forms app (.net 2). In the constructor of the main form I'm trying to set up an object to be remoted over a server tcp channel. I'm only interested in sharing the object with other apps on the same machine.

i.e.

Code:
InitializeComponent();

try
{
  _iview = new iView(this);
  
  BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
  provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

  [b]_channel = new TcpServerChannel("tcpIntegrationViewServer", nPortNo, provider);[/b]
  ChannelServices.RegisterChannel(_channel, false);

  _proxy = RemotingServices.Marshal(_iview, "Namespaces.iView");

it throws a SocketException on the line that creates the new TcpServerChannel, but I've got pretty much identical code working in another exe!?

Here are the exception details:

Message - "No such host is known" {System.Net.Sockets.SocketException}
ErrorCode - 11001
SocketErrorCode - HostNotFound {System.Net.Sockets.SocketError}
Source - "System"
StackTrace:
"at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineName()
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupMachineName()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(String name, Int32 port, IServerChannelSinkProvider sinkProvider)
at Namespace.MainForm..ctor(Mutex sync, Int32 nPortNo)"

The 'ErrorCode' is supposed to be the native error number, but the message isn't any different & after looking into it I'm still pretty stuck. Why would i get host resolution problems? esp. when it's working in another exe with the same code!!

I'm gonna carry on with it & see what I can come up with, but if anyone can help I'd really appreciate it!

Thanks!
 
I've just tested the application, running it from vs2005 & it works fine!! Normally it's shelled (Process.Start'd) from another app. Here's what works & what doesn't:

1) vs2005 - run main app
2) main app shells another app (with identical remoting code to problem app) ok
3) main app shells problem app - remoting exception!!

1) vs2005 - run main app
2) same as above
3) 2nd session vs2005 - problem app works ok!!

all of my exe's are being registered in the gac & i'm running vista...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top