Commit 60a679f5 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

net_SetPort() sets a port within a socket address

parent 19ed4ded
......@@ -331,6 +331,20 @@ static inline uint16_t net_GetPort (const struct sockaddr *addr)
return 0;
static inline void net_SetPort (struct sockaddr *addr, uint16_t port)
switch (addr->sa_family)
#ifdef AF_INET6
case AF_INET6:
((struct sockaddr_in6 *)addr)->sin6_port = port;
case AF_INET:
((struct sockaddr_in *)addr)->sin_port = port;
# ifdef __cplusplus
# endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment