I'm making a multi-user paint. I need to build a network to let multiple clients paint at the same time, but that's giving me problems.

The server of the network collects lists (of points) of every client. After that it puts it together and sends it back to the clients, so they know points of eachother.

The following code gives me a java.net.SocketException: Connection reset at line 64 of Server.

Thanks for the help!

The code:
PHP Code:
package MultiplayerPaint.socket;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.List;

import MultiplayerPaint.DrawingPoint;
import MultiplayerPaint.PaintModel;

public class Client 
{
	Socket socket;
	PaintModel m;
	
	public Client(PaintModel m)
	{
		this.m = m;
		Thread t = new Thread(new Runnable() {
			
			@Override
			public void run() {
				try {
			        socket = new Socket(Server.HOST, Server.PORT);
			        System.out.println("verbinding C");
				}
			      catch (IOException ex) {
			    	  System.err.println(ex);
				}
			}
		});
		t.start();
	}
	
	class IOHandelaar implements Runnable
	{
		public IOHandelaar()
		{
			
		}

		@Override
		public void run() {
			try
			{
				ObjectOutputStream toServer = new ObjectOutputStream(socket.getOutputStream());
		        ObjectInputStream vanServer = new ObjectInputStream(socket.getInputStream());
				//------------------------------------------------------
				while(true)
				{
					Long ms = System.currentTimeMillis();
					toServer.writeObject(m.getPoints());
					m.puntenToevoegen((List<DrawingPoint>) vanServer.readObject());
					Thread.sleep(1000/10);
					System.out.println(System.currentTimeMillis() - ms);
				}
				//------------------------------------------------------
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args)
	{
		//debug stuff
		//PaintModel is a like Point2D
		PaintModel m = new PaintModel();
		for(int i = 0; i< 1000; i++)
			m.updateMouse(i,i,true);
		for(int i = 0; i < 1; i++)
			new Client(m);
		
	}
}
PHP Code:
package MultiplayerPaint.socket;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import MultiplayerPaint.DrawingPoint;


public class Server {
	public final static int PORT = 8000;
	public final static String HOST = "localhost";
	List<Socket> sockets;
	private static Lock lock = new ReentrantLock();
	
	public Server()
	{
		Thread t  = new SocketHandeling();
		Thread t1 = new SocketThread();
		t.start();
		t1.start();
	}
	
	public static void main(String[] args)
	{
		new Server();
	}
	
	class SocketHandeling extends Thread implements Runnable
	{
		public SocketHandeling()
		{
			
		}
		
		public synchronized void run()
		{
			ServerSocket serverSocket;
			try {
				serverSocket = new ServerSocket(PORT);
			
				while(true)
				{
					Socket socket = serverSocket.accept();
					lock.lock();
					sockets.add(socket);
					System.out.println("verbinding" + sockets.size());
					notifyAll();
					lock.unlock();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	class SocketThread extends Thread implements Runnable
	{
	
		ObjectInputStream input;
		
		public SocketThread() {
			super();
			sockets = new ArrayList<Socket>();
		}
	
		public synchronized void run()
		{
			while(true)
			{
				boolean b = false;
				while(!b)
				{
					for(Socket s: sockets)
						b = s.isConnected();
				}
				try{
					lock.lock();
					List<DrawingPoint> lijst = new ArrayList<DrawingPoint>();
					for(Socket s: sockets)
					{
			                        ObjectInputStream inputFromClient = new ObjectInputStream(s.getInputStream());//the error
						lijst.addAll((List<DrawingPoint>) inputFromClient.readObject());
					}
					for(Socket s: sockets)
					{
						ObjectOutputStream inputToClient = new ObjectOutputStream(s.getOutputStream());
						inputToClient.writeObject(lijst);
						inputToClient.flush();
					}
					notifyAll();
					lock.unlock();
				}
				catch(Exception e){e.printStackTrace();
				System.exit(0);}
			}
		}
	}
}