Thread: Socket programming or....

  1. #1
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59

    Socket programming or....

    I almost finished the book "C by example" and I would like to know more about socket programming. Now my question was would I be smart to dive into socket programming or do you suggest reading up on a different subject first?

    Any titles of books would also by appreciated, thanks in advance.

  2. #2

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    The book I started learning C with was a network programming book*, of sorts. It was intended for complete beginners, so the first chapter is called "Programming"; the third chapter is called "Networking" and covers the socket API.

    So no, I cannot even think of a subject that "it would be better for you to read first". And there is plenty of help available here, I don't think anyone who has been programming C for more than 6-12 months is unfamiliar with sockets. They are kind of essential IMO.

    * No Starch Press: Hacking: The Art of Exploitation, 2nd Edition ...great book
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Quote Originally Posted by MK27 View Post
    ...I don't think anyone who has been programming C for more than 6-12 months is unfamiliar with sockets. They are kind of essential IMO.
    [/url] ...great book
    I better get with the program then (no pun intended... )
    Mainframe assembler programmer by trade. C coder when I can.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Dino View Post
    I better get with the program then (no pun intended... )
    okay, lemme add a phrase "If you've been programming in C for more than 6-12 months, it won't take you more than a few hours to get to tackle".

    The socket API is a few structs and a dozen commands.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I'll put this on my list of to-do's to get to before the end of the year. (really)
    Mainframe assembler programmer by trade. C coder when I can.

  7. #7
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    Quote Originally Posted by MK27 View Post
    The book I started learning C with was a network programming book*, of sorts. It was intended for complete beginners, so the first chapter is called "Programming"; the third chapter is called "Networking" and covers the socket API.

    So no, I cannot even think of a subject that "it would be better for you to read first". And there is plenty of help available here, I don't think anyone who has been programming C for more than 6-12 months is unfamiliar with sockets. They are kind of essential IMO.

    * No Starch Press: Hacking: The Art of Exploitation, 2nd Edition ...great book
    Is this book based on coding in C?

  8. #8
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by MK27 View Post
    * ...great book
    MK, you know better than to post hacking links...

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by abachler View Post
    MK, you know better than to post hacking links...
    The author is not a hacker, he is a "security consultant" . I am not really sure whether he means to use the word prejudicially or not. In the introduction he does say:

    Quote Originally Posted by Jon Erickson
    the essence of hacking is finding unintended or overlooked uses for the laws and properties of a given situation and then applying them in new and inventive ways to solve a problem
    which is basically positive and pretty much describes his approach to writing a beginning book on (mostly) C programming. However, he does also introduce explicit examples of how "exploitation" works -- that is how I learned why a buffer overflow can be very bad, like not just segfault bad, for example.

    There are some historical examples of how people have done other bad things (how polymorphic shellcode is constructed, various "DoS attack" methods, TCP/IP hijacking, etc). By the time you are done*, if you are stupid enough, you should be ready to try out some obvious and well known exploit, get traced, and go to jail.

    *actually I am not. Polymorphic shellcode is in the last chapter, "cryptology". The book has a very steep curve in it, something you keep coming back to. It also very code heavy.
    Last edited by MK27; 11-29-2009 at 08:25 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    @MK27, Am I allowed to skip chapter 2 "programming" when I have basic understanding of variables, strings, functions, control structures etc.?

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by JOZZY& Wakko View Post
    @MK27, Am I allowed to skip chapter 2 "programming" when I have basic understanding of variables, strings, functions, control structures etc.?
    I think he basically puts everything you will need to know about C syntax, etc, for the rest of the book in chapter 1, which is over 100 pages. Some of it is quite condensed, like I had to get a "teach yourself C in 7 days" type book from the library as well. So you could probably skip most of it, yeah.

    The networking stuff is a little more detailed, it is almost 100 pages on it's own. However, it has a peculiar slant -- the intro leads up to code for a simple web server, then it goes off into packet sniffing, denial of service, port scanning and hijacking. Interesting, but specialized. Really, it is a book about network security, or an introduction to networking with a very low level and security oriented perpspective. So, a more generally themed networking book may be better (but on the other hand, most of the stuff in a general networking book is probably replicated a dozen times on the web already, whereas that stuff is harder to find).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  12. #12
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by abachler View Post
    MK, you know better than to post hacking links...
    Are you really that misinformed? A book that, first of all, discusses programming in C from a low level perspective along with network programming, and then addresses buffer overflows and cryptography is a 'hacking link' - and better yet, a 'hacking link' is a derogatory term?

    Ugh.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  13. #13
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by IceDane View Post
    Are you really that misinformed? A book that, first of all, discusses programming in C from a low level perspective along with network programming, and then addresses buffer overflows and cryptography is a 'hacking link' - and better yet, a 'hacking link' is a derogatory term?

    Ugh.
    I think it was sarcasm on abachler's part...lol.

    Still, it peeves me as well when people don't know the difference between hackers and crackers.

  14. #14
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    This book is considered the Bible of Socket Programming:

    UNIX Network Programming: Networking APIs: Sockets and XTI; Volume 1

    Get it. It's amazing and has everything you'd ever want to know.

    [Edit]

    Even though it is Unix based, everything in it applies to Windows as well. There's just a few small name changes in the Windows socket API, but other than that it's all the same.

    [/Edit]
    Last edited by DavidP; 12-15-2009 at 01:39 PM.
    My Website

    "Circular logic is good because it is."

  15. #15
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by Epy View Post
    I think it was sarcasm on abachler's part...lol.

    Still, it peeves me as well when people don't know the difference between hackers and crackers.
    Hacker's are people with swine flu.
    Cracker's are white people

    But to be serious, the term cracker was made up by self righteous noobs who didn't want to be associated with the pasty faced computer nerd image of a 'hacker'. There is no difference between the two that is not entirely contrived.
    Last edited by abachler; 12-15-2009 at 02:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket error on non-blocking
    By newbie30 in forum C Programming
    Replies: 1
    Last Post: 09-01-2009, 07:09 AM
  2. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 11:45 AM
  3. Problem with socket descriptors
    By McKracken in forum C Programming
    Replies: 1
    Last Post: 07-22-2009, 08:51 AM
  4. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM