Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

nstream, client not closing in my program.

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
Bump and help is appreciated a lot
-still need help :/


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by SwagDoggerMar 18, 2015 11:51 AM 4 118 Mar 18, 2015 11:51 AM
Last Post: Nuclear3mbargo
[.NET] by DyS-Jul 13, 2014 05:31 AM 12 1,782 Jul 13, 2014 05:31 AM
Last Post: LethalNET
[C] by XerifApr 2, 2014 04:11 AM 9 309 Apr 2, 2014 04:11 AM
Last Post: Nichole