Re: 2.6 kernel network programming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/17/05, linux <[email protected]> wrote:
> Hi all,
> can someone tell me how i can listen and accept connections into a port from
> the kernel-space???
> I start listening with the following function :
> 
>         struct socket *sock;
>         struct sockaddr_in sin;
>         int error=0;
> 
>         error=sock_create(PF_INET,SOCK_STREAM,IPPROTO_TCP,&sock);
> 
>         sin.sin_family = AF_INET;
>         sin.sin_addr.s_addr = INADDR_ANY;
>         sin.sin_port = htons((unsigned short)port);
> 
>         error=sock->ops->bind(sock,(struct sockaddr*)&sin,sizeof(sin));
>         sock->ops->listen(sock,48);
> 
> How about accepting connections and sending some kind of a message for
> beggining?
> Can someone help me please.

Looking at khttpd code in 2.4 kernel may  help you .

http://lxr.linux.no/source/net/khttpd/sockets.c?v=2.4.28

Regards
Niraj
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux