--- oftpd-0.3.7/src/ftp_listener.c
+++ oftpd-0.3.7/src/ftp_listener.c
@@ -159,11 +159,11 @@
 	switch (family) {
 #ifdef INET6
 	case AF_INET6:
-		((struct sockaddr_in6*)&sock_addr)->sin6_port = port;
+		((struct sockaddr_in6*)&sock_addr)->sin6_port = htons(port);
 		break;
 #endif
 	case AF_INET:
-		((struct sockaddr_in*)&sock_addr)->sin_port = port;
+		((struct sockaddr_in*)&sock_addr)->sin_port = htons(port);
 		break;
 	default:
 		/* handle error */
