diff options
| author | cashmere <cashmere@autistici.org> | 2026-06-22 18:35:04 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-06-22 18:35:04 +0200 |
| commit | 02a025e0597fcfc5b08ed4a360548d94f1bc17b0 (patch) | |
| tree | 67e5df4345e799cfc5b7304e32920322fb39e67e | |
| parent | 529285ac3b511a6eb5ebf570fd3c6bda5fa0cfdf (diff) | |
| download | telnet-02a025e0597fcfc5b08ed4a360548d94f1bc17b0.tar.gz | |
src/main.c: add echo functionality
| -rw-r--r-- | src/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -32,8 +32,9 @@ int main() { perror("could not accept connection"); return 1; } - const char *buf = "Hello from telnet!\n"; - write(conn, buf, strlen(buf)); + char buf[1024]; + ssize_t n = read(conn, buf, sizeof(buf)); + write(conn, buf, n); close(conn); } return 0; |
