summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 71cea19..33139b6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,12 +26,15 @@ int main() {
perror("could not listen");
return 1;
}
- int ac = accept(sfd, NULL, NULL);
- if (ac == -1) {
- perror("could not accept");
- return 1;
+ while (1) {
+ int conn = accept(sfd, NULL, NULL);
+ if (conn == -1) {
+ perror("could not accept connection");
+ return 1;
+ }
+ const char *buf = "Hello from telnet!\n";
+ write(conn, buf, strlen(buf));
+ close(conn);
}
- const char *buf = "Hello from telnet!\n";
- write(ac, buf, strlen(buf));
return 0;
}