added send and recv

This commit is contained in:
2025-06-22 15:39:56 -06:00
parent b0371b3444
commit bd8be851bc
+4
View File
@@ -54,6 +54,7 @@ int main(int argc, char* argv[]) {
char *remote_machine, *local_port, *remote_port; char *remote_machine, *local_port, *remote_port;
int status, socketfd, confd, len; int status, socketfd, confd, len;
int yes = 1; int yes = 1;
char *buf;
if (argc != 4) { if (argc != 4) {
printf("Wrong number of arguments. Usage: ./chatty <local port> \ printf("Wrong number of arguments. Usage: ./chatty <local port> \
@@ -168,6 +169,9 @@ int main(int argc, char* argv[]) {
servinfo = q; servinfo = q;
} }
printf("Connected!\n"); printf("Connected!\n");
recv(socketfd, &buf, 20, 0);
printf("%s\n", buf);
} }
/* /*