Wrox Programmer Forums
|
BOOK: Professional VB.NET, 2nd Edition or 2003
This is the forum to discuss the Wrox book Professional VB.NET, 2nd Edition by Fred Barwell, Richard Case, Bill Forgey, Billy Hollis, Tim McCarthy, Jonathan Pinnock, Richard Blair, Jonathan Crossland, Whitney Hankison, Rockford Lhotka, Jan D. Narkiewicz, Rama Ramachandran, Matthew Reynolds, John Roth, Bill Sheldon, Bill Sempf; ISBN: 9780764544002
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional VB.NET, 2nd Edition or 2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2004, 05:44 PM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in Chapter 23

 'Public Sub New(port As Integer)' is obsolete: 'Use TcpListener(IPAddress localaddr, int port).'

any1 know how to dix this?

Tomas


 
Old February 10th, 2004, 10:37 AM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old August 30th, 2005, 12:35 PM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

To listen on ALL ip addresses (page 820 of VB.NET 2003):

Replace the line:
_listener = New TcpListener(Form1.ServicePort)

with:
_listener = New TcpListener(Net.IPAddress.Parse("0.0.0.0"), Form1.ServicePort)


Hope this helps :D,

Ben






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 23 chapter23.xml and TOMCAT I5commuter BOOK: Beginning JavaServer Pages 0 May 22nd, 2008 09:05 AM
Chapter 1, Page 23 golden_drifter BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 7 July 9th, 2004 12:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.