Over the last few years, the Internet of Things (IoT) has grown in protocols, implementations and use cases. In terms of communication protocols, the Constrained Application Protocol (CoAP) prevails among the rest, such as MQ Telemetry Transport (MQTT) or Advanced Message Queuing Protocol (AMQP). This protocol is lightweight and capable of running in resource constrained devices and networks and can be securized using Datagram Transport Layer Security (DTLS). Having a secure channel of communication is important in IoT environments, since IoT devices affect the physical world and exchange personal private data. There exist many implementations of CoAP, each of these with its own particular features and requirements. Therefore, it is important to choose the CoAP implementation that suits better to the specific requirements of each application. This paper presents a feature and empirical comparison of several open source CoAP implementations and also analyzes the security libraries they use. First of all, it surveys current CoAP implementations, and compares them in terms of built-in core, extensions, target platform, programming language and interoperability. Then, a theoretical analysis of the security libraries is provided. Finally, it analyzes CoAP libraries performance in terms of latency, memory and CPU consumption in a real testbed deployed in an industrial scenario, in order to help in adopting a decision criterion for similar deployments.