from Mat Hostetter <mat@lcs.mit.edu>

* remote-utils.c (remote_open): Print out the assigned port number.
This commit is contained in:
Daniel Jacobowitz 2007-02-27 17:21:35 +00:00
parent c499ed39b6
commit 6f8486daac
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2007-02-26 Mat Hostetter <mat@lcs.mit.edu>
* remote-utils.c (remote_open): Print out the assigned port number.
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
* remote-utils.c (monitor_output): New function.

View File

@ -209,6 +209,17 @@ remote_open (char *name)
|| listen (tmp_desc, 1))
perror_with_name ("Can't bind address");
/* If port is zero, a random port will be selected, and the
fprintf below needs to know what port was selected. */
if (port == 0)
{
socklen_t len = sizeof (sockaddr);
if (getsockname (tmp_desc, (struct sockaddr *) &sockaddr, &len) < 0
|| len < sizeof (sockaddr))
perror_with_name ("Can't determine port");
port = ntohs (sockaddr.sin_port);
}
fprintf (stderr, "Listening on port %d\n", port);
fflush (stderr);