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) {
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]));
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);