From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 28 14:08:51 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 058BD16A417 for ; Wed, 28 Nov 2007 14:08:51 +0000 (UTC) (envelope-from fazaeli@sepehrs.com) Received: from sepehrs.com (www.sepehrs.com [213.217.59.98]) by mx1.freebsd.org (Postfix) with ESMTP id 3592E13C4DB for ; Wed, 28 Nov 2007 14:08:49 +0000 (UTC) (envelope-from fazaeli@sepehrs.com) Received: from [192.168.1.180] ([192.168.1.180]) by sepehrs.com (8.13.6/8.13.6) with ESMTP id lASHRP6s018216 for ; Wed, 28 Nov 2007 17:27:26 GMT (envelope-from fazaeli@sepehrs.com) Message-ID: <474D716D.3060907@sepehrs.com> Date: Wed, 28 Nov 2007 17:17:25 +0330 From: "H.fazaeli" User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 CC: freebsd-hackers@freebsd.org References: <360166.14926.qm@web45613.mail.sp1.yahoo.com> In-Reply-To: <360166.14926.qm@web45613.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Sepehr-MailScanner-Information: Please contact the ISP for more information X-Sepehr-MailScanner: Found to be clean X-Sepehr-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.921, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60, DATE_IN_PAST_03_06 0.48) X-MailScanner-From: fazaeli@sepehrs.com X-Spam-Status: No Subject: Re: how to write a raw socket server using UDP X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 14:08:51 -0000 the 2 most common cause for sendto() failure on raw sockets are: - badly initialized IP header. note that ip_len and ip_off must be in host byte order. all other fields must be in net byte order. - badly initialized destination address. writing a raw socket server is not much different than other socket servers: s = socket(AF_INET, SOCK_RAW, 0); if (bind(s, ...) != 0) errx(...) while (1) recvfrom(s, ...) /* recv buffer contains a packet starting with IP header */ sourav das wrote: > hello all, > > i m a new comer. i wrote a raw socket client > using setsockopt (sock, IPPROTO_IP. IPHDRINCL, ....)using UDP. ihave followed > MS_Press network programming . it is showing 19 bytes sent successfully. when > trying to send more than 19 bytes using sendto(sock, ...) function , it is > showing socket error on sending. i want to know how to write a raw socket server > program so that to catch and display the data sent by the client. > > > > thanks a lot, > > keep fit, > > > > regards, > > spike. > > > > > ____________________________________________________________________________________ > Be a better sports nut! Let your teams follow you > with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > >