473,398 Members | 2,393 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,398 software developers and data experts.

Basic C tutorial on networking TCP/IP

Hi,
I'm a student learning TCP/IP networking at University. Although I
understand all about TCP/IP Networking in Java I am expected to understand
the basics of C with regard to these programs as all the examples in my
course notes and Exams refer to C. Can someone please point me in the right
direction to where I might find answers on the web explaining C code
involved with TCP/IP networking and what they mean.
These are quite basic I'm sure.
For example, what is the data type of a socket; or what does char*const host
= "mailserver.uni.ac.uk " or const char * host = "mailserver.uni.ac.uk" or
const char* const host = "mailserver.uni.ac.uk" mean.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ; or what would happen if we if we changed
the above declaration to const double PI = 3.14159 ?
I'm ashemed so say I've not got around to learning C yet . Hence.
Any of the books I have on C don't give me much to go on with regard to
explaining Networking in C unfortunately.
Your help here is greatly appreciated
Regards
Brian
Nov 14 '05 #1
7 8900
"Brian Keogh" <bw*****@btinternet.com> wrote in
news:40********@dnews0.news.legend.net.uk:
I'm a student learning TCP/IP networking at University.


TCP/IP and networking are not part of the C language. Try in one of the
newsgroups that has the word 'networking' or 'tcpip' in it.

--
- Mark ->
--
Nov 14 '05 #2
Although this is OT the best networking tutorial I have found online is at

http://www.ecst.csuchico.edu/~beej/guide/net/
regards
Matt
"Brian Keogh" <bw*****@btinternet.com> wrote in message
news:40********@dnews0.news.legend.net.uk...
Hi,
I'm a student learning TCP/IP networking at University. Although I
understand all about TCP/IP Networking in Java I am expected to understand
the basics of C with regard to these programs as all the examples in my
course notes and Exams refer to C. Can someone please point me in the right direction to where I might find answers on the web explaining C code
involved with TCP/IP networking and what they mean.
These are quite basic I'm sure.
For example, what is the data type of a socket; or what does char*const host = "mailserver.uni.ac.uk " or const char * host = "mailserver.uni.ac.uk" or const char* const host = "mailserver.uni.ac.uk" mean.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ; or what would happen if we if we changed
the above declaration to const double PI = 3.14159 ?
I'm ashemed so say I've not got around to learning C yet . Hence.
Any of the books I have on C don't give me much to go on with regard to
explaining Networking in C unfortunately.
Your help here is greatly appreciated
Regards
Brian

Nov 14 '05 #3
Brian Keogh wrote:
For example, what is the data type of a socket; or what does char*const host
= "mailserver.uni.ac.uk " or const char * host = "mailserver.uni.ac.uk" or
const char* const host = "mailserver.uni.ac.uk" mean.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ; or what would happen if we if we changed
the above declaration to const double PI = 3.14159 ?


The last two questions are about standard C, and have nothing to
do with network programming. I'm afraid that you have to acquire
basic knowledge about C. There are tutorials on the internet, and
there are chapters/pages in the book(s) you do have. We can't
help you any further here.

Good luck,

Case

Nov 14 '05 #4
Many thanks Matt, thats great.
It will give me something to be getting along with regard to my queries

Kind regards,
Brian
"Matthew Jakeman" <m.*******@nospam.lancaster.ac.uk> wrote in message
news:c9**********@alliance.lancs.ac.uk...
Although this is OT the best networking tutorial I have found online is at

http://www.ecst.csuchico.edu/~beej/guide/net/
regards
Matt
"Brian Keogh" <bw*****@btinternet.com> wrote in message
news:40********@dnews0.news.legend.net.uk...
Hi,
I'm a student learning TCP/IP networking at University. Although I
understand all about TCP/IP Networking in Java I am expected to understand the basics of C with regard to these programs as all the examples in my
course notes and Exams refer to C. Can someone please point me in the right
direction to where I might find answers on the web explaining C code
involved with TCP/IP networking and what they mean.
These are quite basic I'm sure.
For example, what is the data type of a socket; or what does char*const

host
= "mailserver.uni.ac.uk " or const char * host = "mailserver.uni.ac.uk" or
const char* const host = "mailserver.uni.ac.uk" mean.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ; or what would happen if we if we

changed the above declaration to const double PI = 3.14159 ?
I'm ashemed so say I've not got around to learning C yet . Hence.
Any of the books I have on C don't give me much to go on with regard to
explaining Networking in C unfortunately.
Your help here is greatly appreciated
Regards
Brian


Nov 14 '05 #5
"Brian Keogh" <bw*****@btinternet.com> wrote:
Hi,
I'm a student learning TCP/IP networking at University. Although I
understand all about TCP/IP Networking in Java I am expected to understand
the basics of C with regard to these programs as all the examples in my
course notes and Exams refer to C. Can someone please point me in the right direction to where I might find answers on the web explaining C code
involved with TCP/IP networking and what they mean.
TCP/IP implementations are typically platform-specific and better discussed
in dedicated newsgroups. They are not part of the C language itself, which
is the only valid topic here.
These are quite basic I'm sure.
For example, what is the data type of a socket; or what does char*const host = "mailserver.uni.ac.uk " or const char * host = "mailserver.uni.ac.uk" or const char* const host = "mailserver.uni.ac.uk" mean.
char *const host = "mailserver.uni.ac.uk";
This declares host as a const pointer to char. The pointer cannot be
modified to point elsewhere, but the object pointed to can be modified.
However, since the array that the pointer is initialised to point into is a
string literal, it is undefined behaviour to modify its contents.

char const *host = "mailserver.uni.ac.uk";
This declares host as a pointer to const char. The pointer can be modified
to point elsewhere, but the object pointed to cannot be modified. This makes
sense when used with a string literal, since it is undefined behaviour to
modify a string literal anyway.

const char *const host = "mailserver.uni.ac.uk";
This declares host as a const pointer to const char. The pointer cannot be
modified to point elsewhere, and the object pointed to cannot be modified
either.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ;
There should be no semicolon in a preprocessor constant like the above. The
compiler never sees the line above, as it has already been substituted by
the preprocessor before the compiler is run. Your code makes all following
occurrences of the token PI in the source code are textually replaced by the
two tokens 3.14159 ; unless and until a directive to undefine PI is reached.
or what would happen if we if we changed
the above declaration to const double PI = 3.14159 ?


That defines a real run-time object, which has scope (either file-scope or
block-scope, depending where it is declared) and linkage (either external
linkage if declared outside a function or no linkage if declared inside a
function). A preprocessor constant has scope until a matching undefine is
reached, and no linkage since it does not even exist after the preprocessor
has finished.

--
Simon.
Nov 14 '05 #6
Simon,
Thank you for taking the time to answer my questions. This is of great help
to me in trying to understand a few of the basics.

Kind Regards,
Brian
news:cf******************************@news.teranew s.com...
"Brian Keogh" <bw*****@btinternet.com> wrote:
Hi,
I'm a student learning TCP/IP networking at University. Although I
understand all about TCP/IP Networking in Java I am expected to understand the basics of C with regard to these programs as all the examples in my
course notes and Exams refer to C. Can someone please point me in the right
direction to where I might find answers on the web explaining C code
involved with TCP/IP networking and what they mean.


TCP/IP implementations are typically platform-specific and better

discussed in dedicated newsgroups. They are not part of the C language itself, which
is the only valid topic here.
These are quite basic I'm sure.
For example, what is the data type of a socket; or what does char*const host
= "mailserver.uni.ac.uk " or const char * host =

"mailserver.uni.ac.uk" or
const char* const host = "mailserver.uni.ac.uk" mean.
char *const host = "mailserver.uni.ac.uk";
This declares host as a const pointer to char. The pointer cannot be
modified to point elsewhere, but the object pointed to can be modified.
However, since the array that the pointer is initialised to point into is

a string literal, it is undefined behaviour to modify its contents.

char const *host = "mailserver.uni.ac.uk";
This declares host as a pointer to const char. The pointer can be modified
to point elsewhere, but the object pointed to cannot be modified. This makes sense when used with a string literal, since it is undefined behaviour to
modify a string literal anyway.

const char *const host = "mailserver.uni.ac.uk";
This declares host as a const pointer to const char. The pointer cannot be
modified to point elsewhere, and the object pointed to cannot be modified
either.
Another is, explain the action of a complier upon encountering the
declaration #define PI 3.14159 ;
There should be no semicolon in a preprocessor constant like the above.

The compiler never sees the line above, as it has already been substituted by
the preprocessor before the compiler is run. Your code makes all following
occurrences of the token PI in the source code are textually replaced by the two tokens 3.14159 ; unless and until a directive to undefine PI is reached.
or what would happen if we if we changed
the above declaration to const double PI = 3.14159 ?
That defines a real run-time object, which has scope (either file-scope or
block-scope, depending where it is declared) and linkage (either external
linkage if declared outside a function or no linkage if declared inside a
function). A preprocessor constant has scope until a matching undefine is
reached, and no linkage since it does not even exist after the

preprocessor has finished.

--
Simon.

Nov 14 '05 #7

"Brian Keogh" <bw*****@btinternet.com> wrote in message

I'm ashemed so say I've not got around to learning C yet . Hence.
Any of the books I have on C don't give me much to go on with
regard to explaining Networking in C unfortunately.

You've got two jobs. Firstly you need to learn the basics of the C language,
and secondly you need to learn how to use a sockets / networking library.
Since ANSI C doesn't come with this library don't expect to find the two
things in the same book.
Since you are already familiar with Java neither of these things should be
too difficult. C has similar control structures to Java but also uses
pointers very heavily. I don't know enough about networking to tell you how
common C libraries and Java differ, but they are likely to be quite similar.
Nov 14 '05 #8

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

Similar topics

3
by: Andy T | last post by:
hi I am after a basic tutorial that uses PHP to create a web page from a text file. All i can find it PHP tuorials that include MySql and I dont need that just yet. I am in urgent need of...
2
by: Rich | last post by:
I am going through one of the tutorials on the Python site, and some of the things mentioned are Tci and Basic. What prompt do I do this commands from? I think I am missing something. I am...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
9
by: Tom | last post by:
Hey all, I've been planning to get myself started with DocBook for quite some time now, so when I unexpectedly encountered a task for which DocBook might actually be very useful, I thought I'd...
9
by: Jay Kim | last post by:
Hi, We're implementing a Windows application using Visual Basic .NET. One of the key features we need to implement is that we should be able to get the accurate byte offset of user selected...
4
by: Hoop | last post by:
Hi, I have been working in getting Boost.Python running on my PC, seems to work now. I have what I believe is somewhat of basic question here. I am starting on an application that will...
1
by: frankhanretty | last post by:
Do I have to install Visual basic on the remote terminals as I did on the server? I have an visual basic 5 application running fine on my client's server and he is now networked. He wants to run the...
28
by: grappletech | last post by:
I took Pascal and BASIC in a couple of beginner programming courses about a decade ago and did well with them. I am good with pseudocode, algorithms, and the mathematics of programming. I decided...
2
by: hkarthik | last post by:
Hi all, Can anybody help me getting a visual basic complete tutorial for free download or in a pdf format.
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.