projects
/
my-code
/
ivac.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-
[my-code/ivac.git]
/
stream.c
diff --git
a/stream.c
b/stream.c
index
834bf47
..
b97a670
100644
(file)
--- a/
stream.c
+++ b/
stream.c
@@
-26,6
+26,9
@@
/* read, close */
#include <unistd.h>
/* read, close */
#include <unistd.h>
+/* defines ... */
+#define MAX_SIZE 1000
+
int main(int argc, char *argv[]) {
int listen_fd, send_fd;
struct sockaddr_in local_addr, remote_addr;
int main(int argc, char *argv[]) {
int listen_fd, send_fd;
struct sockaddr_in local_addr, remote_addr;
@@
-68,12
+71,13
@@
int main(int argc, char *argv[]) {
/* send stuff .... */
read_bytes=1;
while(read_bytes>0) {
/* send stuff .... */
read_bytes=1;
while(read_bytes>0) {
- unsigned char buf[
1000
];
+ unsigned char buf[
MAX_SIZE
];
read_bytes=read(0,buf,sizeof(buf));
send_bytes=send(send_fd,buf,read_bytes,0);
}
close(send_fd);
read_bytes=read(0,buf,sizeof(buf));
send_bytes=send(send_fd,buf,read_bytes,0);
}
close(send_fd);
+ close(listen_fd);
printf("connection closed ...\n");
printf("%d from %d total bytes sent.\n",send_bytes,read_bytes);
}
printf("connection closed ...\n");
printf("%d from %d total bytes sent.\n",send_bytes,read_bytes);
}