#1
  1. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    8
    Rep Power
    0

    Socket Programming in C


    Hello,

    I'm looking for any simple socket programming tutorial or e-book that you know. I have just began to study socket programming. I'm expecting your replies. Thanks...
  2. #2
  3. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    google for 'beej's socket tutorial'
  4. #3
  5. *bounce*
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Delft, The Netherlands
    Posts
    514
    Rep Power
    42
    *shameless plug* :D

    http://analyser.oli.tudelft.nl/beej/

    (Ok, ok, so I didn't write it, I just translated it to dutch, as well as host a mirror...)
    "A poor programmer is he who blames his tools."
    http://analyser.oli.tudelft.nl/
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,223
    Rep Power
    2222
    The other question: Windows or Linux/UNIX?

    The standard sockets API that you learn for UNIX and which Beej's covers very well can be applied to Windows almost directly, but there are a few changes that must be made. These are covered on my Winsock page at http://members.aol.com/DSC30574/sockets/winsock.html .

    And a word of advice. It's easy to hold off from writing sockets programs until you feel that you've learned enough, until you've figured it all out. Don't let that stop you. Jump right in with sample code; it's easier than it looks at first.

    "The Pocket Guide to TCP/IP Sockets: C Version" by Michael J. Donahoo and Kenneth L. Calvert is a hard-copy book (130 pages, US$14.95, second edition title: "TCP/IP Sockets in C: Practical Guide for Programmers"). It's what got me to finally break out of my "analysis paralysis" and start playing with actual code. Even if you don't get the book, their web site at http://cs.baylor.edu/~donahoo/PocketSocket/ has their source code (for UNIX) and the same source code converted to Winsock for Windows. Consider that for a source of working code to start from (echo servers and clients, tcp or udp). It's usually a good idea to have a working server before writing a client and vice versa.

    Have fun. And watch out for byte order.
  8. #5
  9. Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    8
    Rep Power
    0
    Originally posted by dwise1_aol
    The other question: Windows or Linux/UNIX?

    The standard sockets API that you learn for UNIX and which Beej's covers very well can be applied to Windows almost directly, but there are a few changes that must be made. These are covered on my Winsock page at http://members.aol.com/DSC30574/sockets/winsock.html .

    And a word of advice. It's easy to hold off from writing sockets programs until you feel that you've learned enough, until you've figured it all out. Don't let that stop you. Jump right in with sample code; it's easier than it looks at first.

    "The Pocket Guide to TCP/IP Sockets: C Version" by Michael J. Donahoo and Kenneth L. Calvert is a hard-copy book (130 pages, US$14.95, second edition title: "TCP/IP Sockets in C: Practical Guide for Programmers"). It's what got me to finally break out of my "analysis paralysis" and start playing with actual code. Even if you don't get the book, their web site at http://cs.baylor.edu/~donahoo/PocketSocket/ has their source code (for UNIX) and the same source code converted to Winsock for Windows. Consider that for a source of working code to start from (echo servers and clients, tcp or udp). It's usually a good idea to have a working server before writing a client and vice versa.

    Have fun. And watch out for byte order.
    Thanks for all responses. I haven't decided to use windows or unix however I think it is more easy to use windows at first for learning.

IMN logo majestic logo threadwatch logo seochat tools logo