public void run()
	{
		while (running)
		{
			Socket peerSocket;
			try 
			{
				peerSocket = server.accept();
				String remoteAddress = peerSocket.getRemoteSocketAddress().toString();
				int colonIndex = remoteAddress.indexOf(':');
				String ip = remoteAddress.substring(1, colonIndex);
				int port = peerSocket.getPort();
				System.out.println("received connection from: " + ip + ":" + port);
				if (pMgr.getConnectedPeers().contains(Util.findSpecificPeer(pMgr.getConnectedPeers(), ip)))
				{
					System.out.println("already have connection from " + ip + ":" + port);
					peerSocket.close();
				}
				else
				{
					Peer p = new Peer(ip, port, localId, peerSocket);
					p.setPeerManager(pMgr);
					p.start();
				}
				
			}
			catch (SocketException e)
			{
				running = false;
			}
			catch (IOException e) 
			{
				e.printStackTrace();
			}
		}
	}