I'm trying to learn how to make a program that acesses the internet. What class do I need and where can I go for an easy tutorial?
Will you be writing CGI scripts? What OS? VC++ or gcc/g++?
Well, me and a friend are currently working on a large project that will need to acess the internet. The part that we are currently working on is being able to send and recieve messages. Any help? Thank you!
Sounds like you are talking about sockets programming.
Not knowing what classes are offered there, I cannot recommend one. The only class here that covered sockets programming at all was the UNIX Systems Programming and that was just one lecture. A couple Linux classes also provided a background in TCP/IP and we have a class devoted entirely to TCP/IP.
There are a number of good books on the subject as well as web sites. My sockets programming resources page at http://members.aol.com/DSC30574/sockets/resources.html will point you to some.
One book I highly recommend for getting you started fast is "The Pocket Guide to TCP/IP Sockets: C Version" by Michael J. Donahoo and Kenneth L. Calvert -- second edition title is "TCP/IP Sockets in C: Practical Guide for Programmers". It's cheap and thin (130 pages at $15 US). It has working examples and concise and clear explanations to get you up and writing sockets programs fast. I was going through months of "analysis paralysis" researching through several web sites, but this book got me coding.
Now, their approach is strictly UNIX/Linux, whereas in Windows you need to use Winsock. Fortunately, Winsock supports almost everything they cover, so that in most cases you can convert one of their UNIX programs over to Winsock just by adding a few lines and changing a couple more. My resources page's listing of their book points you to a couple resources that describe that process AND I point you to the book's web site which contains both the source code from the book AND also the Winsock translations. Check it out.
Sockets programming usually looks very scary at first, but it really is fairly easy. It's roughly analogous to learning to do file I/O. The hard part is working out the application-layer protocol, which is analogous to working out and using a specific disk-file format.
OBTW, while the book's approach is through C, sockets programming can also be done in several other languages. My resources page mentions a few. I had started on an entire site on sockets programming, but found I needed to reorganize it and have since then not had time. One day.
On my sockets programming index page, http://members.aol.com/DSC30574/sockets/index.html , I offer a basic introduction to the subject and what you need to get started (basically, you should already have the tools). Just in case -- and hoping that -- it helps.
Last edited by dwise1_aol; July 8th, 2003 at 10:26 AM.
Do you know where I could get a Socket package? I've found several however they either need several non-standard headers (which I can't find), give me unresolved exteranals, or have a wall shaped learning curve.
You should not need any special "packages" (sounds like you're talking Ada there). Your development environment should already have all the sockets support you need, unless it's really ancient (more than 5 or 6 years old). Nor should you need any special C++ classes; you can do it in straight BSD sockets code.
What is your OS? Windows (what flavor?)? Linux? MacOS X?
What compiler/development system are you doing this in? And in what language?
Windows XP, Microsoft Visual C++, C++
OK. Read this PDF file, "Transitioning from UNIX to Windows Socket Programming" by Paul O'Steen, at http://cs.baylor.edu/~donahoo/practi...owsSockets.pdf . It describes how to convert a Berkeley sockets program over to Winsock. It also describes the basic structure of a Winsock program.
Then get some sample Winsock programs from http://cs.baylor.edu/~donahoo/PocketSocket/winsock.html . Build them and verify that they work on XP. We've had a few people here having problems getting Winsock programs to run on XP. After I suggested that they make the WSAStartup call for Winsock v2.0 instead of 1.1, they didn't come back, so I assume that it worked. Also, those are multi-file projects, so you'll need to figure which files are needed in the build.
If you are using MFC, I do know that MFC includes a few sockets classes, such as CSocket and CAsyncSocket. I've never used them, since Kruglinski had advised against (see his "Inside Visual C++" book) and since BSD sockets works just fine with Winsock.
Just make sure to include the wsock32.lib library in your project.