projects
/
my-code
/
ivac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e1b1bb6
)
fixed datagram
author
hackbard
<hackbard>
Thu, 17 Oct 2002 15:13:33 +0000
(15:13 +0000)
committer
hackbard
<hackbard>
Thu, 17 Oct 2002 15:13:33 +0000
(15:13 +0000)
Makefile
patch
|
blob
|
history
datagram.c
patch
|
blob
|
history
diff --git
a/Makefile
b/Makefile
index
9d58c28
..
2b51ba5
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-8,5
+8,5
@@
OBJS = stream receive datagram
all: $(OBJS)
all: $(OBJS)
-
uninstall
:
+
clean
:
rm $(OBJS)
rm $(OBJS)
diff --git
a/datagram.c
b/datagram.c
index
75a8d2e
..
5f47a45
100644
(file)
--- a/
datagram.c
+++ b/
datagram.c
@@
-29,7
+29,7
@@
int main(int argc, char *argv[]) {
int send_fd;
struct sockaddr_in local_addr, remote_addr;
int main(int argc, char *argv[]) {
int send_fd;
struct sockaddr_in local_addr, remote_addr;
-
//
socklen_t remote_addr_len;
+ socklen_t remote_addr_len;
int send_bytes, read_bytes;
if(argc!=3) {
int send_bytes, read_bytes;
if(argc!=3) {
@@
-53,7
+53,7
@@
int main(int argc, char *argv[]) {
exit(1);
}
exit(1);
}
-
//
remote_addr_len=sizeof(remote_addr);
+ remote_addr_len=sizeof(remote_addr);
memset(&remote_addr,0,sizeof(remote_addr));
remote_addr.sin_family=AF_INET;
remote_addr.sin_port=htons(atoi(argv[2]));
memset(&remote_addr,0,sizeof(remote_addr));
remote_addr.sin_family=AF_INET;
remote_addr.sin_port=htons(atoi(argv[2]));
@@
-64,7
+64,7
@@
int main(int argc, char *argv[]) {
while(read_bytes>0) {
unsigned char buf[1000];
read_bytes=read(0,buf,sizeof(buf));
while(read_bytes>0) {
unsigned char buf[1000];
read_bytes=read(0,buf,sizeof(buf));
- send_bytes=sendto(send_fd,buf,sizeof(buf),0,
&remote_addr,sizeof(remote_addr)
);
+ send_bytes=sendto(send_fd,buf,sizeof(buf),0,
(struct sockaddr *)&remote_addr,remote_addr_len
);
}
close(send_fd);
}
close(send_fd);