diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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; } |
