Hi Guys! Good Day. Need to ask some help again.

I am developing a client side application that writes a COMMANDS and listens a RESULT.

Now, the server side is made from perl codes..

The task is simple...

Declare Global Variable:
Code:
    Private _TcpClient As New TcpClient
    Private _NetStream As NetworkStream
1. Connect to the Server

Code:
Private Sub Connect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect.Click
        Try
            _TcpClient = New TcpClient
            _TcpClient.Connect("10.0.28.99", 7890)   
        Catch ex As Exception
            Console.WriteLine(Err.ToString())
        End Try
    End Sub
2. Sends Command
Code:
    Private Sub Send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Send.Click
        _NetStream = Nothing
        _NetStream = _TcpClient.GetStream

        Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("22,REGIST,000012\n")
        _NetStream.Write(sendBytes, 0, sendBytes.Length - 1)
    End Sub
3. Receive Result automatically
Code:
    Private Sub ThreadOnRecieve
 Do
            Dim bytes(_TcpClient.ReceiveBufferSize) As Byte

            _NetStream.Read(bytes, 0, CInt(_TcpClient.ReceiveBufferSize))

            Dim returndata As String = Encoding.ASCII.GetString(bytes)

            ReturnLabel.Text = returndata
        Loop
    End Sub
4. Disconnect to the Server
Code:
    Private Sub Disconnect
 _TcpClient.Close()
    End Sub
Now, the problem are:
1. I Am definitely a newbie about TCP/IP
2. I could not send a command until i do this:
Code:
    _NetStream.Flush()
    _NetStream.Close()
but, when i did that. my stream are gone and i am not able to send another command. And when i tried to reconnect again, the server no longer accepts me... seems that my previous connection was still up..

Hope you can enlightens me.. Thanks guys!