title: Java - Sending a String or paragraph via TCP
body: <p>I'm new to Java, and I'm learning how to send messages via the Socket() class.</p>
  
  <p>I'm trying to wrap my brain around how strings are sent and received between 2 simple chat programs.  I've found plenty of examples online, for TCP/UDP chat clients and chat servers.</p>
  
  <p>But I'm still confused with buffered data and strings.</p>
  
  <p>In my code I added 3 fields (field1, field2, area), and a submit button with an event listener.
  Below is part of the code, showing how I attached the listener and the class it instantiates.</p>
  
  <pre><code>......more code above this
  
  button.addActionListener(new ActionListener(){
     public void actionPerformed(ActionEvent e){
       new SendRequest();
     }
  });
  
  
  public class SendRequest{
  
    SendRequest(){
  
     try{
  
        String dip = field1.getText(); // ip address
        String port = field2.getText(); // port num
        int pnum = Integer.parseInt(port);
        String mess = area.getText(); // large text box
        Socket skt = new Socket(dip, pnum);
  
        /* kinda not sure about this part, with strings */
  
  
     }
     catch(IOException io){
        System.out.println("error? " + io.getMessage());
     }
    }
  }
  </code></pre>
  
  <p>I've seen so many example online, that now I'm slightly more confused.</p>
  
  <p>After instantiating the new Socket(), what's a decent way to send multi-line text?</p>