Results 1 to 2 of 2

Thread: Asyncronous socket Error client disconnet

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    199

    Asyncronous socket Error client disconnet

    Hi please help I've already make asynchronous socket work however I"m having issue when client disconnect below is the error code and In the code I highlight were the error trigger.

    Error:
    NullReferenceException was unhandled by user code
    Object reference not set to an instance of an object.

    Code:
        Private Sub DisplayIdle(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles IdleTimer.Elapsed
            For Each Key As String In __ItemList.GetKeyList
                Dim Item As ListViewItem = __ItemList(Key)
                Dim intIdle As Integer = (oServer.Connections(Key).IdleTime \ 1000)
                If (intIdle.ToString <> Item.SubItems(2).Text) Then
                    Item.SubItems(2).Text = intIdle.ToString
                End If
            Next
        End Sub
    I attached the code of asynchronous socket I used for client and server, I have one more issue when I send message on server or client it disconnect the connection between server and client. The author of this code is Paulo S Silva Jr. I convert it to vb.net 2010 to make it work however I has stock with disconnect error when receiving and sending string.

    Can anyone help me please.
    Attached Files Attached Files
    Last edited by tokneneng; Jun 26th, 2012 at 09:06 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Asyncronous socket Error client disconnet

    When a NullReferenceException is thrown is generally means that something before a dot is Nothing. In your case, that means either oServer or oServer.Connections(Key). Find out which and then find out why no object was assigned.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width