int saddr_len, saddr_port;
unsigned int saddr_len; int saddr_port;
int get_port(int sock, int remote) {	struct sockaddr_in saddr;	int saddr_len, saddr_port;		saddr_len = sizeof(saddr);	memset(&saddr, 0, sizeof(saddr));	saddr_port = -1;	if (remote) {		if (!getpeername(sock, (struct sockaddr *)&saddr, &saddr_len)) {			saddr_port = ntohs(saddr.sin_port);		}	} else {		if (!getsockname(sock, (struct sockaddr *)&saddr, &saddr_len)) {			saddr_port = ntohs(saddr.sin_port);		}	}	return saddr_port;}