From owner-freebsd-net Tue Apr 17 12:50:58 2001 Delivered-To: freebsd-net@freebsd.org Received: from technokratis.com (modemcable092.3-201-24.mtl.mc.videotron.ca [24.201.3.92]) by hub.freebsd.org (Postfix) with ESMTP id AC58137B422 for ; Tue, 17 Apr 2001 12:50:33 -0700 (PDT) (envelope-from bmilekic@technokratis.com) Received: (from bmilekic@localhost) by technokratis.com (8.11.3/8.11.3) id f3HJptf13211; Tue, 17 Apr 2001 15:51:55 -0400 (EDT) (envelope-from bmilekic) Date: Tue, 17 Apr 2001 15:51:54 -0400 From: Bosko Milekic To: Jessey Cc: freebsd-net@FreeBSD.ORG Subject: Re: I call sosend occur error . The error code=22. Message-ID: <20010417155154.A13132@technokratis.com> References: <001a01c0c825$aee59300$f3fb1fa3@wen> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <001a01c0c825$aee59300$f3fb1fa3@wen>; from r041102@ms17.hinet.net on Thu, Apr 19, 2001 at 12:36:11AM +0800 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, Apr 19, 2001 at 12:36:11AM +0800, Jessey wrote: > Dear Sir: > I call sosend occur error. The error code=22. > What wrong in my code? > > The code follow: > > socreate(); file://is ok; > > | > } > > top=m_get(MT_DATA,M_DONTWAIT); > > if(top==NULL) > { > log(LOG_INFO, "top=NULL occur error\n"); > goto out; > } > > top->m_next=NULL; > top->m_nextpkt=NULL; > top->m_len=50; > adr=sizeof(struct m_hdr) +sizeof(int)+sizeof(struct ifnet *); > log(LOG_INFO, "adr= %d \n",adr); > > top->m_data=top+adr; ^^^^^^^^^^^^^^^^^^^^^^ First of all, that looks totally bogus! > log(LOG_INFO, "top= %x, top->m_data= %x,top+adr=%x \n",top > ,top->m_data,top+adr); > > top->m_type=MT_DATA; > top->m_flags=M_PKTHDR; > top->m_pkthdr.len=50; > top->m_pkthdr.rcvif=NULL; You should probably just be using m_gethdr. Is this kernel code? > log(LOG_INFO, "top= %x, Data= %x \n",top ,top->m_data); > > error = sosend(so,(struct sockaddr *) &sin,NULL,top, > 0,MSG_DONTROUTE); Error code 22 is EINVAL. Something sosend() calls is telling you that whatever you're passing to sosend() is probably invalid. Are you sure that what you're trying to do is OK? > Thanks/regards -- Bosko Milekic bmilekic@technokratis.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message