91 Chapter 8
It remarks the function of htons(n), the parameter n means the TCP Port
in server application and It helps the programmer to make his own
program easier by referencing the note we provided.
It remarks the function of socket(AF_INET, SOCK_STREAM, 0), the
function of socket(var1,var2,n) means to create the socket of TCP on
Host. Programmer can also create the socket of TCP on the Host by
himself.
edgevtio.dsp
Programmers can choose the develop tools for themselves. For example,
in edgevtio.dsp file, the extension file name .dsp means Microsoft
Developer Studio Project File. Programmer can open the file as a tem-
plate to create their own programs.
edgevtio.dsw
File name of edgevtio means EDG Event I/O, extension name of dsw
means it is a Microsoft Developer Studio Workspace file. This file is
necessary when you open a Developer Studio Project and we make a
warning note in file to reminder you not to modify or delete this related
workspace file.
memset(&HostAddr, 0, sizeof(SOCKADDR_IN));
HostAddr.sin_family = AF_INET;
HostAddr.sin_addr.s_addr = INADDR_ANY;
HostAddr.sin_port = htons(5000);
// |
// +-->The TCP Port in the server application
HostSock = socket(AF_INET, SOCK_STREAM, 0);
// |
// +-->Create the socket of TCP on the Host