Commit 8cdf181e authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Transmitting a file instead of same messages.

parent b55902bf
......@@ -29,12 +29,27 @@ int main(int argc, char* const argv) {
printf("SENDING\n");
for(i= 0; i < 4; i++) {
char buf[30];
sprintf(buf, "this is a message %d", i);
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
fp = fopen("/opt/in.txt", "r");
if (fp == NULL)
exit(EXIT_FAILURE);
while ((read = getline(&line, &len, fp)) != -1) {
char buf[MAX_PAYLOAD_LENGTH];
sprintf(buf, line);
PrrtSocket_send(&sock, buf, strlen(buf));
}
usleep(1000*1000);
fclose(fp);
if (line)
free(line);
usleep(1000*1000*1000);
PrrtSocket_close(&sock);
printf("COMPLETELY CLOSED\n");
return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment