help with sendto (linux)

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
 
C

Christopher Benson-Manica

B.r.K.o.N.j.A. said:
I've been having trouble with sendto function
(etc.)

Then you want to ask your question on comp.unix.programmer. Only
ANSI/ISO C, which does not include sendto() or any other network
functions, is discussed here.
 
D

Default User

B.r.K.o.N.j.A. said:
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)


This is not a standard C function. You need to find a newsgroups where
it is on-topic. There are a number of Linux groups, one is surely right.
If it's a POSIX function (I'm not sure) then comp.unix.programmer might
be suitable.




Brian Rodenborn
 
M

Mark McIntyre

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)

Wrong door. You want comp.unix.programming or somesuch, sockets and
networking are offtopic here, but topical there.
 
B

B.r.K.o.N.j.A.

Thanks, that's what I'll do.

Vedran

Christopher Benson-Manica said:
Then you want to ask your question on comp.unix.programmer. Only
ANSI/ISO C, which does not include sendto() or any other network
functions, is discussed here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top