From 9814ad553986bcb149ebdc97de9100ba0b430443 Mon Sep 17 00:00:00 2001 From: hackbard Date: Thu, 17 Oct 2002 15:13:33 +0000 Subject: [PATCH] fixed datagram --- Makefile | 2 +- datagram.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9d58c28..2b51ba5 100644 --- a/Makefile +++ b/Makefile @@ -8,5 +8,5 @@ OBJS = stream receive datagram all: $(OBJS) -uninstall: +clean: rm $(OBJS) diff --git a/datagram.c b/datagram.c index 75a8d2e..5f47a45 100644 --- 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; - // socklen_t remote_addr_len; + socklen_t remote_addr_len; int send_bytes, read_bytes; if(argc!=3) { @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { 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])); @@ -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)); - 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); -- 2.39.2