Sockets and threads [Solved]

Hello, I spent a major portion of yesterday trying to figure things out and didn’t get far, so I’ve come to ask for help.

So, I want to make a game where the gameplay is very similar to tetris with multiplayer over a network.
Though I’m confused on how to get data transferred between the classes for the actual game and a class for handling the connection, which extends Thread.

Is there any good guide on this? Or could someone give me a few pointers?

I followed a guide from 1997 and got to this:

import java.io.*;
import java.net.Socket;

public class SocketAction extends Thread {

    private DataInputStream inStream;
    protected DataOutputStream outStream;
    private Socket sock;

    public SocketAction(Socket sock) {
        super("SocketAction");


        try {
            inStream = new DataInputStream(new
                    BufferedInputStream(sock.getInputStream(), 1024));
            outStream = new DataOutputStream(new
                    BufferedOutputStream(sock.getOutputStream(), 1024));
            this.sock = sock;
        }
        catch (IOException e) {
            System.out.println("Failed to initialize SocketAction: " + e);
            System.exit(1); //Replacing this later
        }
    }

    public void send(String s) {
        try {
            outStream.writeUTF(s);
        } catch (IOException e) {
            System.out.println("Failed to write to outStream: " + e);
        }
    }
    public String receive() {
        try {
            return inStream.readUTF();
        } catch (IOException e) {
            System.out.println("Failed to read from inStream: " + e);
        }
        return "";
    }

    public boolean isConnected() {
        return ((inStream != null) && (outStream != null) && (sock != null));
    }

    public void closeConnections() {
        try {
            sock.close();
            sock = null;
        }
        catch (IOException e) {
            System.out.println("Failed to close socket: " + e);
        }
    }

    protected void finalize () {
        if (sock != null) {
            try {
                sock.close();
            }
            catch (IOException e) {
                System.out.println("Failed to close socket: "+ e);
            }
            sock = null;
        }
    }
}

Note that I had to do certain things different from the guide due to deprecated methods, so I’m not even sure in what portion this works.
Do you think this class will work for me? Is there any way you think I should improve it?

You’re using TCP because you’re not using a DatagramSocket. A socket(like you’re using) is TCP based.

Alright, thanks.

I modified the main post to state the remaining issue.

Btw, one shouldn’t use Sockets anymore nowadays. It is just reinventing the wheel in a very hard erroneous way.
Give Netty a try and be supprised.

I don’t know how I feel about that. I usually just go for what’s directly available and I think I’ll stick to that.

Edit: Friend helped me out, problems solved.