VCF::TCPSocket Class Reference
A socket class that represents a TCP socket. More...
#include <vcf/NetworkKit/Socket.h>
Inheritance diagram for VCF::TCPSocket:

Public Member Functions | |
| TCPSocket () | |
| Creates an unconnected socket in stStream mode. | |
| TCPSocket (unsigned short port) | |
| Creates a bound and listening socket in stStream mode. | |
| TCPSocket (const String &host, unsigned short port) | |
| Creates a connected socket in stStream mode. | |
| virtual | ~TCPSocket () |
Protected Member Functions | |
| TCPSocket (SocketPeer *peer) | |
| Creates a socket from an existing peer intance. | |
Friends | |
| class | Socket |
Detailed Description
A socket class that represents a TCP socket.Useful for creating a TCP based client or server socket. A simple example for a server might be something like this:
TCPSocket server; server.listen( 1234 ); while ( true ) { Socket* client = server.accept(); { TCPSocketOutputStream sos( *client ); unsigned char bytes[256]; //put some data in the bytes variable... //write to the client socket sos.write( bytes, sizeof(bytes) ); } }
Constructor & Destructor Documentation
|
|
Creates an unconnected socket in stStream mode.
|
|
|
Creates a bound and listening socket in stStream mode.
|
|
||||||||||||
|
Creates a connected socket in stStream mode. A connection is automatically made to the specified host and port. |
|
|
|
|
|
Creates a socket from an existing peer intance. This is used primarily by the accept() method. |
Friends And Related Function Documentation
|
|
|
The documentation for this class was generated from the following file:
- vcf/NetworkKit/Socket.h
