@Override
	public void handleMessage(String sender, String msg)
	{
		String[] parts = msg.split(" ");
		int id = 0;
		if (parts.length == 2)
		{
			try
			{
				id = Integer.parseInt(parts[1]);
			}
			catch (NumberFormatException nfe)
			{
				;
			}
		}
		
		if ( id>0 && id==LANWebcam.sIdentifier )
		{
			mWebcam.takePictures(1);
			List<BufferedImage> imgs = mWebcam.getImages();
			BufferedImage img = imgs.get(0);
			if (img != null)
			{
				mUploadHandler.connect();
				Random r = new Random();
				if (mUploadHandler.uploadImage(img, r.nextInt() + "-" + LANWebcam.sUsername + ".png", "png"))
				{
					System.out.println(mUploadHandler.getRemoteAddress());
				}
				else
				{
					System.err.println("Failed to upload image");
				}
				mUploadHandler.disconnect();
			}
			else
			{
				System.err.println("Could not take picture");
			}
		}
		
		registerHandleMessage();
	}