 		body_length = req |> elem(21) |> byte_size
 		IO.puts("body length #{inspect body_length}")
 		if body_length < length do
-			x = :cowboy_req.part(req)
-			IO.puts("cowboy req #{inspect x}")
-			{:ok, headers, req2} = :cowboy_req.part(req)
-			{:ok, data, req3} = :cowboy_req.part_body(req2)
-			{:file, "inputfile", filename, contentType, _} = :cow_multipart.form_data(headers)
-			IO.puts("junk #{inspect filename} #{inspect contentType}")
+			IO.puts("broke")
 			#io:format("Received file ~p of content-type ~p as follow:~n~p~n~n",
 			#					[Filename, ContentType, Data]),
-			{:ok, req3, opts}
+			#{:ok, req3, opts}
 			#{:ok, req, opts}#why is func there???
 		else
 			body = req |> elem(21) |> PackWrap.unpack |> func.() |> PackWrap.pack

		if ip == {127,0,0,1} do
			f = fn(x) -> tl(tl(tl(tl(tl(tl(x)))))) end
		end
		headers = [{"content-type", "text/plain"},
							 {"access-control-allow-origin", "*"}]
		IO.puts("tcp rec #{inspect req}")
		length = req |> elem(16) |> tl |> hd |> elem(1) |> String.to_integer

end
defmodule Tcp.Handler do
	def init({:tcp, :http}, req, opts) do
		#x = :cowboy_req.part(req)
		#IO.puts("cowboy req #{inspect x}")
		#{:ok, headers, req2} = :cowboy_req.part(req)
		#{:ok, data, req3} = :cowboy_req.part_body(req2)
		#{:file, "inputfile", filename, contentType, _} = :cow_multipart.form_data(headers)
		#{:ok, req3, opts}
		{:ok, req, opts}
	end
	def handle(req, opts) do
