This paper proposes a protocol for a distributed optimization problem in multi-agent networks with equality and inequality constraints. Instead of computing dual optimizations as in previous protocols that can handle constraints, the proposed protocol utilizes additional data of information on past fulfillment of the constraints. Since equality constraints no longer enjoy techniques exploiting strict feasibility of inequality constraints, problems with equality constraints can never be solved by simply extending methods for inequality constraints. To develop a protocol, this paper introduces two diminishing parameters, one of which controls step sizes of decision variables moving to an optimum, while the other specifies the error bound of the equality constraints in each step of iteration. Appropriate choices of these parameters lead to a proof of consensus and convergence of the proposed protocol. A computational example is provided that illustrates the new protocol.