Reputation: 507
My doubt is how linux kernel handles the socket creation, send and receive of data at kernel level? where can I get the source code for them and learn the internal coding?
Upvotes: 0
Views: 225
Reputation: 29804
Linux handles socket's functionality through the VSF (Virtual File System), that's why you can use the filesystem's system calls with a socket file descriptor. Before learning about this you should be familiar with Linux's filesystems and VFS.
When you issue the system call, Linux will allocate a file descriptor in the process's task_struct
and associate it with a socket data structure. The VFS is somehow object oriented and basically a socket structure extends some functionality to use the network protocols on the Linux stack. On this socket data structure there's also information and further method extending, conditioned to what protocol the socket belongs to.
There's a lot happening on the background and sure reading the source code will be the best information, also there is a very good literature about this topic: O'Reilly Understanding Linux Network Internals.
Hope this helps!
Upvotes: 2