TcpClient & TcpListener

bungpeng

Well-known member
Joined
Sep 10, 2002
Messages
906
Location
Malaysia
I create 2 simple applications from TcpClient and TcpListener classes, my purpose is to communicate between 2 application for data sharing.

My problem is that, when I send message from TcpClient to TcpListener, my TcpListener application will do some process and send the "completed" message back to TcpClient. So how do I received this message from TcpClient?

Code:
        Dim Client As TcpClient
        ......

        Client.GetStream().Write(Buffer, 0, Buffer.Length)

        While Not Client.GetStream.DataAvailable()
            Application.DoEvents()
        End While

        If Client.GetStream.DataAvailable() Then
            ......
        End If

If I use above example, the "While Not Client.GetStream.DataAvailable()" process will make the server slow. I did tried to use Timer instead, but it seem to no working, about other ideas?

Thank you
 
I forget exactly where but on Microsofts site if you search this topic youll find a downloadable project in vb.net regarding a tcplistener/client/server app. Its really helpful for this type of programming - its by that Lahothka(sp?) dude
 
Back
Top