Wrox Programmer Forums
|
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 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 May 20th, 2006, 08:41 AM
Registered User
 
Join Date: May 2006
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.

 
Old October 27th, 2006, 09:31 PM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the same problem.:(

 
Old July 10th, 2007, 08:06 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

same here
 
Old October 20th, 2007, 10:57 AM
Registered User
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

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

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

        ' Update the window...
        UpdateCaption()

        ' 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)
        Else
            '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)
        _transmitThread.Start()
        _receiveThread = New Thread(AddressOf ReceiveThreadEntryPoint)
        _receiveThread.Start()

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), _
            args)
            Return
        End If
        ' Create the conversation window...
        Dim conversation As New Conversation
        conversation.Show()
        conversation.ConfigureClient(client, direction)
    End Sub


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

Thanks
 
Old October 22nd, 2007, 12:01 PM
Wrox Author
 
Join Date: May 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old October 23rd, 2007, 12:20 AM
Registered User
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old November 5th, 2007, 12:16 PM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old February 16th, 2008, 09:32 PM
Registered User
 
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.







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 02: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





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