Samchon Framework for CPP
1.0.0
|
An interface for a physical server following web-socket. More...
#include <IWebServer.hpp>
Public Member Functions | |
IWebServer () | |
Default Constructor. More... | |
virtual void | open () override |
Open the web-socket server. More... | |
![]() | |
IServer () | |
Default Constructor. More... | |
virtual void | close () |
Close the server. More... | |
Additional Inherited Members | |
![]() | |
virtual auto | MY_IP () const -> std::string |
(optional) Server's IP More... | |
virtual auto | PORT () const -> int=NULL |
Port number of the server. More... | |
virtual void | addClient (Socket *)=0 |
Handling connection of a physical client. More... | |
![]() | |
Acceptor * | acceptor |
An acceptor for clients. More... | |
An interface for a physical server following web-socket.
IWebServer is a IServer following web-socket protocol.
IServer provides methods for opening a server.
IServer is one of the basic 3 + 1 components that can make any type of network system in Samchon Framework with IProtocol and IClient. Looking around classes in Samchon Framework, you can see all servers are implemented from the IServer.
When a client connects to the server, the abstract method IServer::addClient() is called with a new thread. If you want to accept only a client at a time, use OneToOneServer instead.
A simple chat server running on console
Definition at line 19 of file IWebServer.hpp.
IWebServer::IWebServer | ( | ) |
Default Constructor.
Definition at line 21 of file IWebServer.cpp.
|
overridevirtual |
Open the web-socket server.
Accepts clients and handshake with them following web-socket protocol.
Reimplemented from samchon::protocol::IServer.
Definition at line 25 of file IWebServer.cpp.
References samchon::protocol::IServer::acceptor, samchon::protocol::IServer::addClient(), samchon::WeakString::between(), samchon::protocol::IServer::MY_IP(), samchon::protocol::IServer::PORT(), samchon::ByteArray::read(), and samchon::ByteArray::writeReversely().