Hack Forums
[.NET] nstream, client not closing in my program. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] nstream, client not closing in my program. (/showthread.php?tid=3911341)



nstream, client not closing in my program. - Moon Rock - Dec 6, 2013

So I have a remote desktop view program and it'll start, but once you click stop on the client side it'll stop. Later once you want to view them again you connect... you press start and the program crashes. So I stop and view were the code it at on the client and it's here.

Code
While client.Connected = True
            nstream = client.GetStream
            PictureBox1.Image = bf.Deserialize(nstream)
        End While

So the server side isn't closing it's connection from the last session. How do I close it?

Code the server uses to send images.

Code
If Not client.Connected Then
                client.Connect("192.168.1.66", port2)
            End If
            thread2 = New Thread(AddressOf TMR)
            thread2.Start()

Code
Public Sub TMR()
        Try
            T.Start()
        Catch ex As Exception
        End Try
    End Sub

Code
Sub TElapsed() Handles T.Elapsed
        SendImage()
    End Sub

Code
Private Sub SendImage()
        Dim bf As New BinaryFormatter
        nstream = client.GetStream
        bf.Serialize(nstream, Desktop())
    End Sub



* - Moon Rock - Dec 10, 2013

Bump and help is appreciated a lot
-still need help :/