Ejemplo n.º 1
0
void Listen::Tcp() {
  try {
    ListenOn(*listener_tcp_);
    while (listener_tcp_ && listener_tcp_->IsValid()) {
      AcceptClient();
    }
  } catch (NetworkException e) {
    Display::Console::PrintError(e.what());
    Error::LogToFile(e.what(), e.code(), e.message());
  }
}
Ejemplo n.º 2
0
int TCPSocket::CreateTCPServer() {
	sprintf(Message, "Server: Initiating TCP Server...\n");
	easyLog("bold");
	addrinfo *ai;
	if (AppStat)
		FlushAll();
	if ((ai = GetAddrInfo()) == NULL)
		return 1; //Error On Getting Address Information
	if ((mySocketFD = GetBind(ai)) == -1)
		return 2; //Error On Binding Socket
	if (SocketBlockingMode())
		return 3;
	if (ListenOn() == -1)
		return 4; //Error On Listener
	sprintf(Message, "Server Ready: TCP Connection Management started...\n");
	easyLog("bold");
	AppStat = true;
	ManageConnections();
	return 0;
}