listenSocket(0),
outerSocket(0),
refreshPeriod(0),
- listenWebAddr(0),
- outerAddrLen(0)
+ listenWebAddr(0)
{
#ifdef WIN32
res = WSAStartup(MAKEWORD(2,0), &wsaData);
void WEB::PrepareNet()
{
listenSocket = socket(PF_INET, SOCK_STREAM, 0);
+
+struct sockaddr_in listenAddr;
listenAddr.sin_family = AF_INET;
listenAddr.sin_port = htons(LISTEN_PORT);
listenAddr.sin_addr.s_addr = listenWebAddr;
printf("Listen failed.\n");
exit(0);
}
-
-outerAddrLen = sizeof(outerAddr);
}
//---------------------------------------------------------------------------
void WEB::SetRefreshPagePeriod(int p)
char recvBuffer[4096];
while (1)
{
+ struct sockaddr_in outerAddr;
+
+ #ifndef WIN32
+ socklen_t outerAddrLen = sizeof(outerAddr);
+ #else
+ int outerAddrLen = sizeof(outerAddr);
+ #endif
+
outerSocket = accept(listenSocket, (struct sockaddr*)&outerAddr, &outerAddrLen);
if (outerSocket == -1)
{
void UpdateStat(const LOADSTAT & ls);
void Start();
private:
-
void PrepareNet();
+ int SendReply();
+ int SendCSS();
+ int Redirect(const char * url);
#ifdef WIN32
WSADATA wsaData;
pthread_t thread;
#endif
- int SendReply();
- int SendCSS();
- int Redirect(const char * url);
-
- string dirName[DIR_NUM];
- int res;
- int listenSocket;
- int outerSocket;
- struct sockaddr_in listenAddr;
- struct sockaddr_in outerAddr;
- int refreshPeriod;
+ string dirName[DIR_NUM];
+ int res;
+ int listenSocket;
+ int outerSocket;
+ int refreshPeriod;
- uint32_t listenWebAddr;
- LOADSTAT ls;
+ uint32_t listenWebAddr;
+ LOADSTAT ls;
list<STG_MESSAGE> messages;
-
- #ifndef WIN32
- socklen_t outerAddrLen;
- #else
- int outerAddrLen;
- #endif
};
//-----------------------------------------------------------------------------
-