Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jan 2003 08:20:49 +0000
From:      "soheil soheil" <soheil_hh@hotmail.com>
To:        freebsd-net@freebsd.org
Subject:   The socket sendto INVALID ARGUMENT ERROR returned
Message-ID:  <F1174y3Y9MErThctRDi0001213f@hotmail.com>

next in thread | raw e-mail | index | archive | help
Dear all
I wrote a code to send a tcp packet on a raw socket,
but the sendto function return some errors on argument
what can make this error occur ???
thanx
the code :
char datagram[4096];
.....
socket(s, SOCK_RAW, IPPROTO_TCP);
.....//filling the tcp/ip header
int             one = 1;
const int      *val = &one;
if (setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof(one)) < 0)
	printf("Warning: Cannot set HDRINCL!\n");
if(sendto(s,datagram, sizeof(struct tcphdr),  0,(struct sockaddr *)&sin,
		   sizeof(sin)) < 0)
		           perror("error on send");


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F1174y3Y9MErThctRDi0001213f>