Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional VB 2005 ISBN: 0-7645-7536-8
This is the forum to discuss the Wrox book Professional VB 2005 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon; ISBN: 9780764575365
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old May 20th, 2006, 08:41 AM
Registered User
Join Date: May 2006
Location: , , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 27 Run-time Error

The Wrox Messenger program runs OK until you try to connect, then you get an exception error "System.exception: Couldn't retrieve Client property from TcpClient". The 2 messenger windows start up but there is no communication between them.

I know this is a new book, but I assume the code was tested before being used as examples so it's disappointing that so much of it appears not to work.

  #2 (permalink)  
Old October 27th, 2006, 09:31 PM
Registered User
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I have the same problem.:(

  #3 (permalink)  
Old July 10th, 2007, 08:06 AM
Registered User
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

same here
  #4 (permalink)  
Old October 20th, 2007, 10:57 AM
Registered User
Join Date: Oct 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

This seems to be a problem with reflection. Everything works fine up until reflection code is added.

   Public Sub ConfigureClient(ByVal client As TcpClient, _
    ByVal direction As ConversationDirection)

        ' Set it up...
        _client = client
        _direction = direction

        ' Update the window...

        ' Get the stream...
        _stream = _client.GetStream()

        ' Get the socket through reflection...
        Dim propertyInfo As PropertyInfo = _
        _client.GetType().GetProperty("Client", _
        BindingFlags.Instance Or BindingFlags.NonPublic)
        If Not propertyInfo Is Nothing Then
            _socket = propertyInfo.GetValue(_client, Nothing)
            'This is the exception that is thrown ever since reflection was added
            Throw New Exception("Couldn’t retrieve Client property from TcpClient")

        End If

        ' Spin up the threads...
        _transmitThread = New Thread(AddressOf TransmitThreadEntryPoint)
        _receiveThread = New Thread(AddressOf ReceiveThreadEntryPoint)

End Sub
'Program halts on this line...

Protected Sub ProcessConnection(ByVal client As TcpClient, _
ByVal direction As Conversation.ConversationDirection)
        ' Do you have to move to another thread?
        If IsMainThread() = False Then
            ' Create and call...
            Dim args(1) As Object
            args(0) = client
            args(1) = direction
            Invoke(New ProcessConnectionDelegate(AddressOf ProcessConnection), _
        End If
        ' Create the conversation window...
        Dim conversation As New Conversation
        conversation.ConfigureClient(client, direction)
    End Sub

Any ideas besides omitting the reflection and letting the program error on disposal?

  #5 (permalink)  
Old October 22nd, 2007, 12:01 PM
Wrox Author
Join Date: May 2004
Location: Indianapolis, Indiana, .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Were there firewalls between the computers you were attempting to connect?

  #6 (permalink)  
Old October 23rd, 2007, 12:20 AM
Registered User
Join Date: Oct 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Katiem,
no, both clients were running on the same machine without a firewall...

  #7 (permalink)  
Old November 5th, 2007, 11:16 AM
Registered User
Join Date: Nov 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I'm having the same problem. Have any of the previous posters had any luck solving it?

None of the code in the whole "Shutting Down the Application" (pages 986 through 990) seems to work properly.

  #8 (permalink)  
Old February 16th, 2008, 08:32 PM
Registered User
Join Date: Feb 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Has there been a resolution to this issue? We initially thought it might be a firewall issue but that proved to be false. I don't see any updated errata either. We played around trying to implement something similar on our promotional items site but have totally given up pending a solution. A lot of what we learned using these books we've applied to the site.
Absolutely great books, I just wish they'd follow up on some of the older titles from time to time which is really the only limitation in these otherwise great books.


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
run-time error(s) Chacko C++ Programming 0 March 4th, 2007 01:28 PM
run time error ashishroyk Java GUI 0 October 8th, 2004 01:42 AM
Run Time Error JBond Access VBA 0 May 27th, 2004 09:50 AM
RUN-TIME ERROR compcad Beginning VB 6 2 May 21st, 2004 02:01 AM

All times are GMT -4. The time now is 05:48 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.