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
 [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to