int main(int argc, char *argv[]) {
int send_fd;
struct sockaddr_in local_addr, remote_addr;
- socklen_t remote_addr_len;
- int send_bytes;
+ // socklen_t remote_addr_len;
+ int send_bytes, read_bytes;
if(argc!=3) {
printf("usage: %s <target-ip/broadcast-addr> <port>\n",argv[0]);
memset(&remote_addr,0,sizeof(remote_addr));
remote_addr.sin_family=AF_INET;
remote_addr.sin_port=htons(atoi(argv[2]));
- remote_addr.sin_addr=inet_addr(argv[1]);
+ remote_addr.sin_addr.s_addr=inet_addr(argv[1]);
/* send stuff .... */
read_bytes=1;
while(read_bytes>0) {
unsigned char buf[1000];
read_bytes=read(0,buf,sizeof(buf));
- send_bytes=sendto(send_fd,buf,sizeof(buf),&remote_addr,sizeof(remote_addr);
+ send_bytes=sendto(send_fd,buf,sizeof(buf),0,&remote_addr,sizeof(remote_addr));
}
close(send_fd);
int main(int argc, char *argv[]) {
int receive_fd;
struct sockaddr_in target_addr;
- socklen_t target_addr_len;
int receive_bytes, write_bytes;
if(argc!=3) {