Here is how to resolve your own ip and get a free port to use for a client in socket code. Since SDL Net doesn't have this functionality, I had to code it myself.
unsigned int ip;
unsigned short port;
SOCKET s= socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
hostent *hostent= gethostbyname(hostname);
ip= *(unsigned int *)hostent->h_addr_list;
getsockname(s, (sockaddr *)&sa, &namelen);
You should never use a static port for client connections; you should always attempt to find a free port with a method like this.
There is a bit of a catch, if you are on a LAN, this will resolve your ip on the LAN; not the router's external ip.
The ip is stored in the 4 octet ipv4 format so to print it out you have to go through some small hoops:
printf("Your ip is %i.%i.%i.%i", ip&0xFF, (ip>>8)&0xFF, (ip>>16)&0xFF, ip>>24);