Dec 122017
 
A C++ class for Winsock socket interface.
File CWINSOCK.ZIP from The Programmer’s Corner in
Category C++ Source Code
A C++ class for Winsock socket interface.
File Name File Size Zip Size Zip Type
CLASSYWS.CPP 4120 1656 deflated
CLASSYWS.HPP 1388 651 deflated
CWINSOCK.CPP 8202 2094 deflated
CWINSOCK.DEF 237 141 deflated
CWINSOCK.HPP 4644 1384 deflated
CWINSOCK.MAK 2293 871 deflated
CWINSOCK.WRI 3840 1707 deflated
CWINSOCK.WSP 802 303 deflated

Download File CWINSOCK.ZIP Here

Contents of the CWINSOCK.WRI file


1QCWINSOCK
A C++ Base Class for Winsock

Copywrite Notice
GENISYS Comm retains rights to the source code included with this distribution dated 7 Nov 93.

Distribution Policy
GENISYS Comm releases this software into the public domain, and allows it to be copied and distributed freely with notice to the author. The existing copyright notice must be preserved in the source code, and credit given to GENISYS Comm for any commercially developed products.

Introduction
It has become apparent to the author that the WINSOCK specification call out for a C++ standard along the lines of the MFC definitions. As he has already implemented several such classes for his GCP++ product, the enclosed definition was quickly prototyped.
The reader's initial reaction may be to question the need for such a definition. As implemented here, the CWinsock base class is little more than an encapsulation of the winsock functions with internal data items for the socket descriptor, window, and callback message. To these readers I respond with "Yes, you are correct. But the elegance of the CWinsock class is that it provides a base class for special derived classes, providing structure for encapsulation and future state and error checking".
The CWinsock class definition is not completed, as it does not yet provide error checking, etc. This will be competed in the Beta version.

Comments from Readers
Please forward your comments to the author, and your suggestions will be folded into future versions of the spec.

Derived Class Example
Although the CWinsock base class defined could be used "as is" (all the function members are public for this purpose), the author recommends that it be used primarily as a base class for specific applications. For example, a CTcpDaemon class could be developed that adds a Listen(unsigned int Port) member function. This function would create a TCP socket, bind it, and listen on the port specified. Since all these function are synchronous blocking, all the functionality could be included within the single Listen() function, returning an error code if unsuccessful.

Naming Conventions
Before we figured out how to eliminate the naming confusion between the WINSOCK calls and our class calls, we modified the class function names and adopted a standard (non-BSD UNIX) format. For non-WSA Winsock functions, we capitailized each word's first letter in the CWinsock class function. For WSA functions, we removed the WSA prefix. We like the result, and would prefer to keep it if there is no great objection. I'm sure that those involved with the original naming (adopting the BSD function names and parameters) will have something to say. I only ask you consider that since the arguments must change, this would be a good time to adopt a consistent naming convention.

Contacting the Author
Michael Baldwin can be reached by:
e-mail:[email protected]
mail:GENISYS Comm, 314 S. Jay St, Rome, NY 13440
phone:315-339-5502
fax:315-339-5528ons, we capitailized each word's first letter ixtp"l7hSda`\X~TPLV^N^wsoQk7hSda`\X~TPLV^N^xx "7QSafa|~<)?Safa|~< Arial


 December 12, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)