|
|
 |
 |
 |
 |
difference between socktype ad protocol?
hallo, I'd like to understand the difference between socktype ad protocol: in getaddrinfo or in cration of socket we have two arguments: socketype and protocol: ai_socktype: can have SOCK_STREAM, SOCKDGRAM, SOCKRAW ai_protocol: 0 or IPPROTO_xxx (es. IPPROTO_TCP , IPPROTO_UDP) SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of IPPROTO_UDP? what is the difference between socktype ad protocol? thank you in advance, Mario.
On Sun, 03 Jun 2007 22:35:14 +0200, in comp.lang.c , "_mario.lat" <n @libero.it> wrote: >hallo, >I'd like to understand the difference between socktype ad protocol: >in getaddrinfo or in cration of socket we have two arguments: >socketype and protocol: >ai_socktype: can have SOCK_STREAM, SOCKDGRAM, SOCKRAW >ai_protocol: 0 or IPPROTO_xxx (es. IPPROTO_TCP , IPPROTO_UDP) >SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of >IPPROTO_UDP? >what is the difference between socktype ad protocol? >thank you in advance,
This isn't really a C question - you will probably get a good answer in comp.unix.programmer though, where networking is more topical. -- Mark McIntyre "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan
In article <pan.2007.06.03.20.34.53.888@libero.it>, _mario.lat <n @libero.it> wrote: >I'd like to understand the difference between socktype ad protocol: >SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of >IPPROTO_UDP? >what is the difference between socktype ad protocol? That's a networking question rather than a C question; like the other poster said, the unix newsgroup would be a better place for the details. [OT] The approximate answer is that SOCK_STREAM is a class that includes *any* kind of reliable transport, and SOCKDGRAM is a class that includes *any* kind of transport that handles individual unreliable messages. For example, there are "improved" TCP-like protocols that work better under particular conditions (e.g., some are optimized for high bandwidth and low latency such as LAN links; some are optimized for high error loss and high latency such as talking to spacecraft.) These protocols are not TCP nor UDP, so they are neither IPPROTO_TCP nor IPPROTO_UDP, but they are still SOCK_STREAM or SOCK_UDP. -- Programming is what happens while you're busy making other plans.
"Walter Roberson" <rober @ibd.nrc-cnrc.gc.ca> wrote in message news:f3vdtm$mei$1@canopus.cc.umanitoba.ca...
> In article <pan.2007.06.03.20.34.53.888 @libero.it>, > _mario.lat <n @libero.it> wrote: >>I'd like to understand the difference between socktype ad protocol: >>SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of >>IPPROTO_UDP? >>what is the difference between socktype ad protocol? > That's a networking question rather than a C question; like the > other poster said, the unix newsgroup would be a better place for > the details. > [OT] > The approximate answer is that SOCK_STREAM is a class that includes > *any* kind of reliable transport, and SOCKDGRAM is a class that > includes *any* kind of transport that handles individual unreliable > messages. > For example, there are "improved" TCP-like protocols that work better > under particular conditions (e.g., some are optimized for high > bandwidth and low latency such as LAN links; some are optimized for > high error loss and high latency such as talking to spacecraft.) > These protocols are not TCP nor UDP, so they are neither IPPROTO_TCP > nor IPPROTO_UDP, but they are still SOCK_STREAM or SOCK_UDP.
<OT> The above is not wrong, but originally sockets were intended to be used with a variety of protocols, not just IP. DECnet, XNS, IPX, AppleTalk, OSI, VINES, etc. have various sub-protocols similar to TCP and/or UDP which would fit into the SOCK_STREAM, SOCK_DGRAM, or other types as well. A few were actually even implemented on various systems, but they've fallen out of use (obviously). At the time DARPA contracted BBN to implement what came to be known as "BSD sockets", though, nobody had any clue IP would eventually obliterate all other networking protocols and so they created one complicated syscall that could potentially handle all protocols instead of needing a separate syscall for each protocol. </OT> -- Stephen Sprunk "Those people who think they know everything CCIE #3723 are a great annoyance to those of us who do." K5SSS --Isaac Asimov -- Posted via a free Usenet account from http://www.teranews.com
"Stephen Sprunk" <step @sprunk.org> writes: > "Walter Roberson" <rober @ibd.nrc-cnrc.gc.ca> wrote in message > news:f3vdtm$mei$1@canopus.cc.umanitoba.ca... >> In article <pan.2007.06.03.20.34.53.888 @libero.it>, >> _mario.lat <n @libero.it> wrote: >>>I'd like to understand the difference between socktype ad protocol: >>>SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of >>>IPPROTO_UDP? >>>what is the difference between socktype ad protocol? >> That's a networking question rather than a C question; like the >> other poster said, the unix newsgroup would be a better place for >> the details. >> [OT] >> The approximate answer is that [...] > <OT> > The above is not wrong, but originally
[...] In my opinion, this illustrates why attempting to provide off-topic answers, even if they're marked as such, is a bad idea. The above discussion should have taken place in comp.unix.programmer. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
"Stephen Sprunk" <step @sprunk.org> wrote in message news:466339f5$0$16350$88260bb3@free.teranews.com...
> "Walter Roberson" <rober @ibd.nrc-cnrc.gc.ca> wrote in message > news:f3vdtm$mei$1@canopus.cc.umanitoba.ca... >> In article <pan.2007.06.03.20.34.53.888 @libero.it>, >> _mario.lat <n @libero.it> wrote: >>>I'd like to understand the difference between socktype ad protocol: >>>SOCK_STREAM is not the same as TCP and SOCKDGRAM is not the same of >>>IPPROTO_UDP? >>>what is the difference between socktype ad protocol? >> That's a networking question rather than a C question; like the >> other poster said, the unix newsgroup would be a better place for >> the details. >> [OT] >> The approximate answer is that SOCK_STREAM is a class that includes >> *any* kind of reliable transport, and SOCKDGRAM is a class that >> includes *any* kind of transport that handles individual unreliable >> messages. >> For example, there are "improved" TCP-like protocols that work better >> under particular conditions (e.g., some are optimized for high >> bandwidth and low latency such as LAN links; some are optimized for >> high error loss and high latency such as talking to spacecraft.) >> These protocols are not TCP nor UDP, so they are neither IPPROTO_TCP >> nor IPPROTO_UDP, but they are still SOCK_STREAM or SOCK_UDP. > <OT> > The above is not wrong, but originally sockets were intended to be used > with a variety of protocols, not just IP. DECnet, XNS, IPX, AppleTalk, > OSI, VINES, etc. have various sub-protocols similar to TCP and/or UDP > which would fit into the SOCK_STREAM, SOCK_DGRAM, or other types as well. > A few were actually even implemented on various systems, but they've > fallen out of use (obviously). At the time DARPA contracted BBN to > implement what came to be known as "BSD sockets", though, nobody had any > clue IP would eventually obliterate all other networking protocols and so > they created one complicated syscall that could potentially handle all > protocols instead of needing a separate syscall for each protocol. > </OT>
<MORE OT> Some of those protocols defined more than what DGRAM and STREAMS convey. Often "level two" protocols are implied by some. I have personally known of a broken implementation of TCP/IP taking down an entire LAN from a different vendor. </MORE OT>
|
 |
 |
 |
 |
|