From 54a039a60bd87657dc6b645239526807ab1d4d01 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Mon, 20 Feb 2023 19:34:58 +0100 Subject: [PATCH] added IP select at client startup --- src/chat/client/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/chat/client/main.c b/src/chat/client/main.c index c7510ff..3938af1 100644 --- a/src/chat/client/main.c +++ b/src/chat/client/main.c @@ -18,6 +18,8 @@ along with this program. If not, see . #include +#include + void send_socket(char *text, int socket); int main(void) @@ -32,6 +34,11 @@ int main(void) server_addr.sin_port = htons(SERVER_PORT); server_addr.sin_addr.s_addr = INADDR_ANY; + printf("Welcome.\n\nEnter IP Address:\n>>> "); + getline(&line, &line_length, stdin); + + server_addr.sin_addr.s_addr = inet_addr(line); + int connectStatus = connect(listen_socket, (SA *) &server_addr, sizeof(server_addr)); //CONNECT if (connectStatus < 0) why2_die("Connecting failed.");