LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 03-29-2009, 11:25 PM   #1
ahm_irf
Member
 
Registered: Feb 2007
Posts: 37

Rep: Reputation: 15
differences between "struct sock" and "struct socket"


can anyone tell me some differences between "struct sock" and "struct socket" that are data structures of network protocol stack ?

till now I just find out that 'struct sock' provides the interface downward to the kernel and 'struct socket' provides interface upward to userspace.

Please correct me if I am wrong and also provide more differences.
 
Old 03-29-2009, 11:28 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,858
Blog Entries: 1

Rep: Reputation: Disabled
Q: Exactly what header file(s) are you looking at?
 
Old 03-30-2009, 01:09 AM   #3
ahm_irf
Member
 
Registered: Feb 2007
Posts: 37

Original Poster
Rep: Reputation: 15
include/net/sock.h

include/net/socket.h
 
Old 03-30-2009, 04:43 AM   #4
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 805

Rep: Reputation: 161Reputation: 161
I'm on Slackware 12.1, and it has neither /usr/include/net/sock.h nor /usr/include/net/socket.h.

What system are you using?
 
Old 03-30-2009, 10:29 AM   #5
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,858
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

"/usr/include/sys/socket.h" is an appropriate header to use for a user-space sockets program. Here's a good example:

http://beej.us/guide/bgnet/output/ht...l#simpleclient

"/usr/src/linux/include/net/sock.h" is a kernel header for the kernel implementation of TCP/IP.

You can (and should) view the two definitions as completely separate and unrelated.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
where is "last_syscall" variable (struct thread_struct) in 2.6 kernel ashok449 Linux - Kernel 0 03-20-2009 08:44 AM
in which header file the "struct omap_dev" can find in 2.6.22 hallimanju Linux - Software 1 06-02-2008 07:25 AM
Perl scripting: Data structure similar to C's "struct" kenneho Programming 3 05-25-2008 08:20 AM
g++ doesn't support "C-struct member initialization" extension of gcc? ta0kira Programming 8 04-13-2008 02:57 PM
C declaration problem for a "typedef struct". Spirals Linux - Software 3 03-17-2008 07:52 AM


All times are GMT -5. The time now is 04:43 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration