Skip to content

Commit f02daf1

Browse files
committed
Make servers more verbose about connections.
1 parent b7036b2 commit f02daf1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

apps/gateway.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ static void tcp_to_ncp (const char *port, const char *host, const char *sock)
140140
int connection, foreign_port;
141141
int fd, s, size;
142142

143+
fprintf (stderr, "Listening to port %s.\n", port);
144+
143145
s = inet_server (port);
144146
fd = inet_accept (s, &foreign_host, &foreign_port);
145147
fprintf (stderr, "Connection from host %s on port %d.\n",
@@ -161,6 +163,7 @@ static void tcp_to_ncp (const char *port, const char *host, const char *sock)
161163
exit (1);
162164
}
163165

166+
fprintf (stderr, "Forwarding to host %d socket %d.\n", ncp_host, ncp_sock);
164167
transport (fd, connection);
165168

166169
if (ncp_close (connection) == -1) {
@@ -173,6 +176,8 @@ static void ncp_to_tcp (int sock, const char *host, const char *port)
173176
{
174177
int fd, ncp_host, connection, size;
175178

179+
fprintf (stderr, "Listening to socket %d.\n", sock);
180+
176181
size = 8;
177182
if (ncp_listen (sock, &size, &ncp_host, &connection) == -1) {
178183
fprintf (stderr, "NCP listen error.\n");
@@ -181,6 +186,7 @@ static void ncp_to_tcp (int sock, const char *host, const char *port)
181186
fprintf (stderr, "Connection from host %03o on socket %d.\n", ncp_host, sock);
182187

183188
fd = inet_connect (host, port);
189+
fprintf (stderr, "Forwarding to host %s port %s.\n", host, port);
184190
transport (fd, connection);
185191

186192
if (ncp_close (connection) == -1) {

apps/telnet.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ static void telnet_server (int host, int sock,
400400
fprintf (stderr, "NCP listen error.\n");
401401
exit (1);
402402
}
403+
fprintf (stderr, "Connection from host %03o.\n", host);
403404

404405
reader_fd = reader (connection);
405406
writer_fd = writer (connection);

0 commit comments

Comments
 (0)