projects
/
my-code
/
ivac.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed dgramrcv.c
[my-code/ivac.git]
/
receive.c
diff --git
a/receive.c
b/receive.c
index
36f8ffd
..
105a81c
100644
(file)
--- a/
receive.c
+++ b/
receive.c
@@
-32,7
+32,7
@@
int main(int argc, char *argv[]) {
int receive_bytes, write_bytes;
if(argc!=3) {
int receive_bytes, write_bytes;
if(argc!=3) {
- printf("usage: %s <port>\n",argv[0]);
+ printf("usage: %s <
target-ip> <
port>\n",argv[0]);
exit(1);
}
exit(1);
}
@@
-52,13
+52,11
@@
int main(int argc, char *argv[]) {
exit(1);
}
exit(1);
}
- printf("connected.\n");
-
receive_bytes=1;
while(receive_bytes>0) {
unsigned char buf[1000];
receive_bytes=recv(receive_fd,buf,sizeof(buf),0);
receive_bytes=1;
while(receive_bytes>0) {
unsigned char buf[1000];
receive_bytes=recv(receive_fd,buf,sizeof(buf),0);
- write_bytes=write(1,buf,
sizeof(buf)
);
+ write_bytes=write(1,buf,
receive_bytes
);
}
close(receive_fd);
}
close(receive_fd);