dart/gni/ds_base_gni.c
int port_search(int socket)
{
  int port;
  int err;
  socklen_t len = sizeof(struct sockaddr);

  struct sockaddr_in address;
  memset(&address, 0, sizeof(struct sockaddr_in));
  err = getsockname(socket, (struct sockaddr *)&address, &len);
  if(err < 0)
    return err;
  port = ntohs(address.sin_port);
  return port;
}
// Get the auto-assigned port number

Get the auto-assigned port number
Get the auto - assigned port number
int port_search(int socket)
{
  int port;
  int err;
  socklen_t len = sizeof(struct sockaddr);
  struct sockaddr_in address;
  memset(&address, 0, sizeof(struct sockaddr_in));
  err = getsockname(socket, (struct sockaddr *)&address, &len);
  if(err < 0)
    return err;
  port = ntohs(address.sin_port);
  return port;
}
int port_search ( int socket ) { int port ; int err ; socklen_t len = sizeof ( struct sockaddr ) ; struct sockaddr_in address ; memset ( & address , 0 , sizeof ( struct sockaddr_in ) ) ; err = getsockname ( socket , ( struct sockaddr * ) & address , & len ) ; if ( err < 0 ) return err ; port = ntohs ( address . sin_port ) ; return port ; }
Get the auto-assigned port number
Get the auto - assigned port number