-
-
Save Rolias/677e6e83e154a2d60640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This is a private Gist. The term private can be misleading. It just means it isn't available for public searching. Anyone | |
//that has the URL for this gist can read it. Here's an example of a code paset from Eclipse. I put ".cpp" on the title of | |
//of this Gist so that Gist knows it is c++ code and will do some formatting. | |
void TcpServer::ConnectAndProcess() | |
{ | |
DebugUtil::Write("In TcpServer::ConnectAndProcess() "); | |
if (IsShutdownRequested()) | |
{ | |
cout << "TcpServer::ConnectAndProcess() shutdown has been requested."<< endl; | |
} | |
while (!IsShutdownRequested() && ListenSocketIsValid()) | |
{ | |
const bool connected = WaitForConnection(); | |
if (connected) | |
{ | |
_keepAlive.SetConnection(_tcpConnection); | |
_keepAlive.Enabled(KeepAliveEnabled()); | |
OSTimeDly(1);// give any process launching us a chance to pend on mailbox | |
ProcessMessagesWhileConnectionOpen(); | |
DebugUtil::Write("Connection Ended"); | |
CloseConnection(); | |
} | |
else | |
{ | |
DebugUtil::Write("Connection not made within timeout period."); | |
} | |
} | |
string msg = "Exiting TcpServer::ConnectAndProcess() either shutdown requested or listen socket is not valid"; | |
DebugUtil::Write(msg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment