B
B.r.K.o.N.j.A.
I've been having trouble with sendto function (I open a socket, bind it to
eth0, recvfrom works fine but when I execute following line I get sendto():
invalid argument)
if(sendto(sokit, buf, sizeof(buf), 0, (struct sockaddr *)&drugaadr,
sizeof(drugaadr))==-1){
perror("sendto()")
exit(-1)
}
sokit is int variable with socket handler (value 3)
buf is declared char[60]
drugaadr is struct sockaddr_in
drugaadr.sin_family=AF_INET;
drugaadr.sin_port=0;
drugaadr.sin_addr.s_addr=inet_addr("192.168.0.1");
and the drugaadr.sin_zero is filled with 8 zeros.
Please help (I'm trying to send an ARP packet, but that's within buf, and it
shouldn't have anything to do with sendto failure), I've searched the
internet but came empty-handed.
Thanks,
Vedran
eth0, recvfrom works fine but when I execute following line I get sendto():
invalid argument)
if(sendto(sokit, buf, sizeof(buf), 0, (struct sockaddr *)&drugaadr,
sizeof(drugaadr))==-1){
perror("sendto()")
exit(-1)
}
sokit is int variable with socket handler (value 3)
buf is declared char[60]
drugaadr is struct sockaddr_in
drugaadr.sin_family=AF_INET;
drugaadr.sin_port=0;
drugaadr.sin_addr.s_addr=inet_addr("192.168.0.1");
and the drugaadr.sin_zero is filled with 8 zeros.
Please help (I'm trying to send an ARP packet, but that's within buf, and it
shouldn't have anything to do with sendto failure), I've searched the
internet but came empty-handed.
Thanks,
Vedran