Make 'port' a string in NET module

- avoids dependency on snprintf
- allows using "smtps" instead of "456" if desired
diff --git a/library/net.c b/library/net.c
index 8dd4c09..f284153 100644
--- a/library/net.c
+++ b/library/net.c
@@ -86,12 +86,6 @@
 #include <stdint.h>
 #endif
 
-#if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
-#else
-#define mbedtls_snprintf snprintf
-#endif
-
 /*
  * Prepare for using the sockets interface
  */
@@ -119,26 +113,21 @@
 /*
  * Initiate a TCP connection with host:port and the given protocol
  */
-int mbedtls_net_connect( int *fd, const char *host, int port, int proto )
+int mbedtls_net_connect( int *fd, const char *host, const char *port, int proto )
 {
     int ret;
     struct addrinfo hints, *addr_list, *cur;
-    char port_str[6];
 
     if( ( ret = net_prepare() ) != 0 )
         return( ret );
 
-    /* getaddrinfo expects port as a string */
-    memset( port_str, 0, sizeof( port_str ) );
-    mbedtls_snprintf( port_str, sizeof( port_str ), "%d", port );
-
     /* Do name resolution with both IPv6 and IPv4 */
     memset( &hints, 0, sizeof( hints ) );
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = proto == MBEDTLS_NET_PROTO_UDP ? SOCK_DGRAM : SOCK_STREAM;
     hints.ai_protocol = proto == MBEDTLS_NET_PROTO_UDP ? IPPROTO_UDP : IPPROTO_TCP;
 
-    if( getaddrinfo( host, port_str, &hints, &addr_list ) != 0 )
+    if( getaddrinfo( host, port, &hints, &addr_list ) != 0 )
         return( MBEDTLS_ERR_NET_UNKNOWN_HOST );
 
     /* Try the sockaddrs until a connection succeeds */
@@ -171,19 +160,14 @@
 /*
  * Create a listening socket on bind_ip:port
  */
-int mbedtls_net_bind( int *fd, const char *bind_ip, int port, int proto )
+int mbedtls_net_bind( int *fd, const char *bind_ip, const char *port, int proto )
 {
     int n, ret;
     struct addrinfo hints, *addr_list, *cur;
-    char port_str[6];
 
     if( ( ret = net_prepare() ) != 0 )
         return( ret );
 
-    /* getaddrinfo expects port as a string */
-    memset( port_str, 0, sizeof( port_str ) );
-    mbedtls_snprintf( port_str, sizeof( port_str ), "%d", port );
-
     /* Bind to IPv6 and/or IPv4, but only in TCP */
     memset( &hints, 0, sizeof( hints ) );
     hints.ai_family = AF_UNSPEC;
@@ -192,7 +176,7 @@
     if( bind_ip == NULL )
         hints.ai_flags = AI_PASSIVE;
 
-    if( getaddrinfo( bind_ip, port_str, &hints, &addr_list ) != 0 )
+    if( getaddrinfo( bind_ip, port, &hints, &addr_list ) != 0 )
         return( MBEDTLS_ERR_NET_UNKNOWN_HOST );
 
     /* Try the sockaddrs until a binding succeeds */