473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

source code for tcp/ip stack

hello can anbody help me in getting source code for tcp/ip stack in
ANSI C or source code for http protocol

Apr 28 '06 #1
7 5266
sandy opined:
hello can anbody help me in getting source code for tcp/ip stack in
ANSI C or source code for http protocol


What's wrong with Google? You used it to post this.

--
linux: because a PC is a terrible thing to waste
(ks*@cis.ufl.edu put this on Tshirts in '93)

<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Apr 28 '06 #2
In article <a-********************@bt.com>,
Vladimir Oka <no****@btopenworld.com> wrote:
sandy opined:
hello can anbody help me in getting source code for tcp/ip stack in
ANSI C or source code for http protocol

What's wrong with Google? You used it to post this.


It would take rather a lot of googling to find source code for
a TCP/IP stack written in standard ANSI C, as the C standards
know nothing about the existance of networks. Any TCP/IP stack
would have to contain operating-system specific calls
that are beyond the scope of the C standards.

In order to write a TCP/IP stack, at the very minimum one
needs to have a routine to accept a packet from hardware,
and another to dispatch an arbitrary packet towards hardware.
Such low-level calls are not available even in POSIX.1.
Source code for the http protocol is also problematic, but for
a different reason: a -protocol- is not the same thing as
an -implementation- of the protocol. There are many implementations
available (such as Apache) -- none of which can be written purely
in standard C though.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Apr 28 '06 #3
In article <e2**********@canopus.cc.umanitoba.ca>,
Walter Roberson <ro******@ibd.nrc-cnrc.gc.ca> wrote:
In order to write a TCP/IP stack, at the very minimum one
needs to have a routine to accept a packet from hardware,
and another to dispatch an arbitrary packet towards hardware.
Such low-level calls are not available even in POSIX.1.


That's not much of a problem, since a couple of calls to functions
defined elsewhere doesn't affect the standard-C-ness of the stack
itself. A more serious problem is that a real implementation is
likely to use virtual memory tricks to avoid copying data, and will be
designed to fit into some particular operating system.

-- Richard
Apr 28 '06 #4
In article <e2***********@pc-news.cogsci.ed.ac.uk>,
Richard Tobin <ri*****@cogsci.ed.ac.uk> wrote:
In article <e2**********@canopus.cc.umanitoba.ca>,
Walter Roberson <ro******@ibd.nrc-cnrc.gc.ca> wrote:
In order to write a TCP/IP stack, at the very minimum one
needs to have a routine to accept a packet from hardware,
and another to dispatch an arbitrary packet towards hardware.
Such low-level calls are not available even in POSIX.1.

That's not much of a problem, since a couple of calls to functions
defined elsewhere doesn't affect the standard-C-ness of the stack
itself.
For the purposes of this newsgroup, the only ANSI C programs
are those for which all the source could {theoretically} be examined
and found not to use any extensions or constructs or system calls
not documented as the ANSI/ISO standards as existing.

I suppose in theory one -could- have an OS in which packetization
was accomplished by fopen()/fclose() on a magic filename -- the result
wouldn't be much portable, but the code could be ANSI C. Failing
that, ANSI C does not provide any method to signal the end of a packet
within a stream. To stay entirely within ANSI C would then require
use of features documented as implementation-defined -- in particular,
of converting an integral value to a pointer and dereferencing
in order to access memory-mapped hardware. That would be ANSI C, but
not portable... I suppose you just -might- find source for such a
thing via google, if you looked long enough (or knew exactly what
you were looking for.)

A more serious problem is that a real implementation is
likely to use virtual memory tricks to avoid copying data, and will be
designed to fit into some particular operating system.


But virtual memory tricks are inherently tricks with memory-mapped
locations, so the integer -> pointer conversion would have a better
chance of being meaningful ;-)
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Apr 28 '06 #5
Richard Tobin wrote:
In article <e2**********@canopus.cc.umanitoba.ca>,
Walter Roberson <ro******@ibd.nrc-cnrc.gc.ca> wrote:

In order to write a TCP/IP stack, at the very minimum one
needs to have a routine to accept a packet from hardware,
and another to dispatch an arbitrary packet towards hardware.
Such low-level calls are not available even in POSIX.1.

That's not much of a problem, since a couple of calls to functions
defined elsewhere doesn't affect the standard-C-ness of the stack
itself. A more serious problem is that a real implementation is
likely to use virtual memory tricks to avoid copying data, and will be
designed to fit into some particular operating system.

There are several "tiny" IP stacks out there designed for 8 bit embedded
use that should meet the OP's requirements. I haven't trawled the
source for ANSI compatibility, but these stacks are designed for
portability.

Spend some time with Mr. Google.

--
Ian Collins.
Apr 28 '06 #6
In article <4b*************@individual.net>,
Ian Collins <ia******@hotmail.com> wrote:
There are several "tiny" IP stacks out there designed for 8 bit embedded
use that should meet the OP's requirements. I haven't trawled the
source for ANSI compatibility, but these stacks are designed for
portability.


The uIP stack is one example,
http://www.sics.se/~adam/uip/

It is fairly cleanly written, but if one digs down far enough,
it relies upon the "tapdev" device driver which is written
in terms of ioctl(). The non-portable portion is certainly
isolated, but it's still non-portable.
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Apr 28 '06 #7
Walter Roberson wrote:
In article <4b*************@individual.net>,
Ian Collins <ia******@hotmail.com> wrote:

There are several "tiny" IP stacks out there designed for 8 bit embedded
use that should meet the OP's requirements. I haven't trawled the
source for ANSI compatibility, but these stacks are designed for
portability.

The uIP stack is one example,
http://www.sics.se/~adam/uip/

It is fairly cleanly written, but if one digs down far enough,
it relies upon the "tapdev" device driver which is written
in terms of ioctl(). The non-portable portion is certainly
isolated, but it's still non-portable.


True, you will hit the hardware or OS at some point, but as a stack,
this is a good, clean example.

--
Ian Collins.
Apr 28 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Bill Marsden | last post by:
Hi. I am an under-graduate currently studying Open Source (Linux) vs Closed Source and Collaboration within the IT Community. I am fairly new to Javascript and I have written a "Lottery Program"...
16
by: Fronsac | last post by:
Hi, I've been asked in a job interview how to make C code look like C++ code, and honestly I didn't know what to answer because I have never really done a lot of C. Now, I've been searching around...
3
by: Bruce D | last post by:
I'm new to .NET and I have a error that is coming up but it's not telling me where the error is coming from (no file). Is that because I'm doing something wrong...or is it a type of error that has...
5
by: Pavils Jurjans | last post by:
Hello, I have to debug an ASP.NET project which is hosted on the remote server, and it is not possible to achieve the same environment on localhost. So, I need to debug on the remote site....
1
by: Gummy | last post by:
Hello, I've been banging my head against the wall for a few days on this. When I run a page, either in "View in Browser" or I actually build the solution, I occasionally and very randomly get...
4
by: C.W. | last post by:
I lost my laptop as well as my backup server. I am wondering if there is a way to step through the code without the source code, but only with the dll and pdb (which are compiled in debug mode)...
1
by: sandy | last post by:
hello can anbody help me in getting source code for tcp/ip stack in ANSI C or source code for http protocol
3
by: Adam Sandler | last post by:
Hello all, I'm trying to use VWD 2005 Express Edition to connect to a database. For my initial prototyping though, I'm just using an Excel spreadsheet as the source and everything resides on the...
3
by: samtilden | last post by:
During my code's processing of an exception, I would like to format the exception myself. I can get almost everything (I can get exception itself, stack trace, file name, line number, method,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.