sample: use unsigned short instead of int for port

The C standard gurantees that an unsigned short is at least up to 65535
huge. Enough to store every TCP port. Also the parameter PORT is
overgiven to the `htons()` function which assumes that the parameter is
of type `uint16_t` which unsigned short is on most platforms.
This commit is contained in:
Emil Engler 2021-04-02 21:02:12 +02:00 committed by Azat Khuzhin
parent 0ef0d9475c
commit e77f187274

View File

@ -27,7 +27,7 @@
static const char MESSAGE[] = "Hello, World!\n";
static const int PORT = 9995;
static const unsigned short PORT = 9995;
static void listener_cb(struct evconnlistener *, evutil_socket_t,
struct sockaddr *, int socklen, void *);