title: VB.Net Server & Java Client (Socket) Send & Receive Text
body: <p>I am new to Java programming
  I wrote a simple Server(VB.NET) / Client(Java) program. 
  Text from Java is send successfully to VB.Net but Response from VB.Net is not received in Java</p>
  
  <p>Am I missing something?</p>
  
  <p>Here are my Codes</p>
  
  <p>VB.NET (Server)</p>
  
  <pre><code>Imports System.Net.Sockets, System.Text
  Public Class Form1
  
  Dim server As New TcpListener(9999)
  Dim client As New TcpClient
  Dim stream As NetworkStream
  
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
  End Sub
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
      Me.Text = "Waiting...."
      server.Start()
      client = server.AcceptTcpClient
      'Receive msg'
      stream = client.GetStream()
      Dim r_byt(client.ReceiveBufferSize) As Byte
      stream.Read(r_byt, 0, client.ReceiveBufferSize)
      Dim str As String = Encoding.ASCII.GetString(r_byt)
      Label1.Text = str
      'Send msg'
      Dim s_byt() As Byte = Encoding.UTF8.GetBytes("got it")
      stream.Write(s_byt, 0, s_byt.Length)
      stream.Close()
  End Sub
  
  End Class
  </code></pre>
  
  <p>Java(Client)</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  
  public class frmClient {
  
  public static void main(String[] args) throws Exception{
      frmClient myCli = new frmClient();
      myCli.run();
  
  }
  
  public void run() throws Exception{
      Socket socket = new Socket("192.168.0.100", 9999);
      PrintStream stream = new PrintStream(socket.getOutputStream());
      stream.println("Hello Server...");
  
      BufferedReader buffer = new BufferedReader(new InputStreamReader(socket.getInputStream()));
      String string = buffer.readLine();
      System.out.println(string);
  }
  }
  </code></pre>