[Mono-list] Cannot listen with TcpChannel

Mike Mazur mmazur at gmail.com
Mon Apr 28 04:07:58 EDT 2008


Hi,

Having trouble with TcpChannel throwing an exception:

$ cat temp_test.cs
using System;
using System.Net;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MainClass
{
       public static void Main()
       {
           try
           {
               TcpChannel ch = new TcpChannel(8895);
           }
           catch (Exception ex)
           {
               Console.WriteLine("Exception while attempting to
listen on TCP port 8895.");
               throw (ex);
           }
       }
}
$ mcs -r:System.Runtime.Remoting.dll temp_test.cs
temp_test.cs(13,28): warning CS0219: The variable `ch' is assigned but
its value is never used
Compilation succeeded - 1 warning(s)
$ mono temp_test.exe
Exception while attempting to listen on TCP port 8895.

Unhandled Exception: System.Net.Sockets.SocketException: No such host is known
 at System.Net.Dns.GetHostByName (System.String hostName) [0x00000]
 at System.Net.Dns.Resolve (System.String hostName) [0x00000]
 at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.Init
(IServerChannelSinkProvider serverSinkProvider) [0x00000]
 at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor
(IDictionary properties, IServerChannelSinkProvider
serverSinkProvider) [0x00000]
 at System.Runtime.Remoting.Channels.Tcp.TcpChannel.Init (IDictionary
properties, IClientChannelSinkProvider clientSink,
IServerChannelSinkProvider serverSink) [0x00000]
 at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor (Int32
port) [0x00000]
 at MainClass.Main () [0x00000]

I also tried the example at
http://www.gotmono.com/docs/remoting/introduction.html but this
exhibits the same problem.

I'm new to Mono development, so I'm not too familiar with all its
libraries and/or components. Could I be missing some libraries? I'm
running Mono 1.2.5.1 on Gentoo Linux.

Thanks in advance,
Mike


More information about the Mono-list mailing list