At the beginning:
Bytes --------------------------------------------------------------------------------------
This translation is not a standard one-word translation!
It is a product of understanding as a programmer!
If you are interested, you can use your email to communicate with me! (Welcome to your discussion)
My mailbox: veic_2005 # 163.com( replace # @)
------------------------------------------------------------------ Perfect split line --
Copyright:
Beej's Guide Network to Programming
Using Internet Sockets
Brian "Beej Jorgensen" Hall
Beej@beej.us
Version 3.0.14
September 8, 2009
Copyright©2009 Brian "Beej Jorgensen" Hall
1. Introduction
Alas! Is Socket programming frustrating to you? Is it difficult to obtain useful information from man pages? But you are overwhelmed by the bind () structure before calling connect? Wait...
Fortunately, I have completed these tasks and I will share my knowledge with everyone. If you understand the C language and want to pass through the swamp of network programming, you are right.
I finally caught up with the future (at the last moment) and updated the IPv6 guide! Enjoy!
1.1 audience
This document is a guide rather than a reference book. If you are new to socket programming and want to find an entry book, you are my reader. But this is not a complete socket programming book.
1.2 platform and Compiler
Most of the Code in this document is successfully compiled on the Linux platform PC using GNU gcc.
1.3 Official Website
Http://beej.us/guide/bgnet/
1.4 attention should be paid to Solaris/SunOS programmers
When compiling on Solaris or SunOS, you must have more parameters. As shown below:
$ Cc-o server. c-lnsl-lsocket-lresolv
1.5 Windows programmer's note
You must add the following header file (unless you have installed Cygwin)
# Include <winsock. h>
In addition, WSAStartup () must be called first, as shown below:
# Include <winsock. h>
...
{
WSADATA wsaData; // if this doesn't work
// WSData wsaData; // then try this instead
// MAKEWORD (1, 1) for Winsock 1.1, MAKEWORD (2, 0) for Winsock 2.0:
If (WSAStartup (MAKEWORD (1, 1), & wsaData )! = 0 ){
Fprintf (stderr, "WSAStartupfailed. \ n ");
Exit (1 );
}
}
Finally, you must call WSACleanup ().
End.
From the column xiaobin_HLJ80