Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LARN
PRRT
Commits
8cdf181e
Commit
8cdf181e
authored
Feb 12, 2016
by
Andreas Schmidt
Browse files
Transmitting a file instead of same messages.
parent
b55902bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
sender.c
View file @
8cdf181e
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment