mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
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:
parent
0ef0d9475c
commit
e77f187274
@ -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 *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user