Hello serial69,
here is an example to fix this problem in CSharp:
The long form with debug:
Code:
string localDnsName = Dns.GetHostName();
Console.WriteLine("Dns name : " + localDnsName );
IPHostEntry localHost = Dns.Resolve( localDnsName );
Console.WriteLine("Host name : " + localHost.HostName);
IPAddress[] localAddresses = localHost.AddressList;
Console.WriteLine("IP address List : ");
foreach( IPAddress ip in localAddresses )
Console.WriteLine( ip );
//alternativ:
//for(int i=0; i < localAddresses.Length; i++)
// Console.WriteLine( localAddresses[i] );
// listen on port 4567
TcpListener tcpServer = null;
if( localAddresses.Length > 0 )
tcpServer = new TcpListener( localAddresses[0], 4567 );
Or the short form without debug:
Code:
IPHostEntry localHost = Dns.Resolve( Dns.GetHostName() );
TcpListener tcpServer
= new TcpListener( localHost.AddressList[0], 4567 );
I hope that helps you, else see:
http://<br />
<a href="http://www.o...html</a><br />
Ronald