aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--daemon/mutatorclient.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/daemon/mutatorclient.c b/daemon/mutatorclient.c
index dfc0ec4..5686783 100644
--- a/daemon/mutatorclient.c
+++ b/daemon/mutatorclient.c
@@ -55,7 +55,6 @@ int main(int argc, char *argv[])
perror("connect failed.error.");
return 1;
}
-
puts("connected.");
/*keep communicating with the server.*/
@@ -64,18 +63,29 @@ int main(int argc, char *argv[])
printf("enter massage: ");
/*@DEVI-should later do something about reading from stdin*/
- if (fgets(message, 2000, stdin) == NULL)
+ if (fgets(message, 4000, stdin) == NULL)
{
puts("could not read from stdin");
}
puts("read from stdin.");
+ if (strncmp(message, "end_comm", 8) == 0)
+ {
+ puts("client terminated.");
+ break;
+ }
+
/*send some data*/
if (send(sock, message, strlen(message), 0) < 0)
{
puts("send fialed.");
return 1;
}
+ puts("message sent.");
+ puts(message);
+
+ sleep(1);
+ fflush(stdin);
/*recieve a reply from the server*/
if (recv(sock, server_reply, 2000, 0) < 0)
@@ -87,12 +97,12 @@ int main(int argc, char *argv[])
puts("server reply: ");
puts(server_reply);
-#if 0
- if (strncmp(server_reply, "end_comm", strlen(server_reply)))
+ for (int i = 0; i < 2000; ++i)
{
- break;
+ server_reply[i] = 0;
}
-#endif
+
+ fflush(stdout);
}
close(sock);