sending and receiving working
This commit is contained in:
@@ -54,7 +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;
|
char buf[10];
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4) {
|
||||||
printf("Wrong number of arguments. Usage: ./chatty <local port> \
|
printf("Wrong number of arguments. Usage: ./chatty <local port> \
|
||||||
@@ -169,7 +169,6 @@ int main(int argc, char* argv[]) {
|
|||||||
servinfo = q;
|
servinfo = q;
|
||||||
}
|
}
|
||||||
printf("Connected!\n");
|
printf("Connected!\n");
|
||||||
buf = calloc(4, sizeof(char));
|
|
||||||
recv(socketfd, &buf, 20, 0);
|
recv(socketfd, &buf, 20, 0);
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user