Click here to Skip to main content
15,922,894 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem getting openGL current screen Pin
imranlodhi25-Aug-04 19:50
imranlodhi25-Aug-04 19:50 
GeneralGet Video Card info, like getVolumeinfo Pin
Anonymous24-Aug-04 18:43
Anonymous24-Aug-04 18:43 
QuestionConnecting to Mysql database??? Pin
Linera24-Aug-04 18:09
Linera24-Aug-04 18:09 
AnswerRe: Connecting to Mysql database??? Pin
David Crow25-Aug-04 3:13
David Crow25-Aug-04 3:13 
Generalsearch function help Pin
CShoun24-Aug-04 17:05
CShoun24-Aug-04 17:05 
GeneralRe: search function help Pin
David Crow25-Aug-04 3:11
David Crow25-Aug-04 3:11 
GeneralAdd/Remove Programs Pin
Ed K24-Aug-04 15:17
Ed K24-Aug-04 15:17 
GeneralRe: Add/Remove Programs Pin
Graham Bradshaw25-Aug-04 3:09
Graham Bradshaw25-Aug-04 3:09 
GeneralRe: Add/Remove Programs Pin
Ed K25-Aug-04 5:14
Ed K25-Aug-04 5:14 
GeneralRe: Add/Remove Programs Pin
David Crow25-Aug-04 3:20
David Crow25-Aug-04 3:20 
GeneralC++ dialog question Pin
Linera24-Aug-04 14:22
Linera24-Aug-04 14:22 
GeneralRe: C++ dialog question Pin
Ravi Bhavnani24-Aug-04 15:02
professionalRavi Bhavnani24-Aug-04 15:02 
GeneralRe: C++ dialog question Pin
Linera24-Aug-04 15:12
Linera24-Aug-04 15:12 
GeneralRe: C++ dialog question Pin
ThatsAlok24-Aug-04 21:32
ThatsAlok24-Aug-04 21:32 
GeneralRe: C++ dialog question Pin
Rajesh match24-Aug-04 20:17
Rajesh match24-Aug-04 20:17 
GeneralRe: C++ dialog question Pin
Linera25-Aug-04 8:06
Linera25-Aug-04 8:06 
GeneralRe: C++ dialog question Pin
Rajesh match25-Aug-04 19:15
Rajesh match25-Aug-04 19:15 
GeneralRe: C++ dialog question Pin
Linera26-Aug-04 7:20
Linera26-Aug-04 7:20 
GeneralCreateProcess question... Pin
RobJones24-Aug-04 13:51
RobJones24-Aug-04 13:51 
GeneralRe: CreateProcess question... Pin
Archer28224-Aug-04 16:30
Archer28224-Aug-04 16:30 
GeneralRe: CreateProcess question... Pin
RobJones25-Aug-04 4:02
RobJones25-Aug-04 4:02 
GeneralWindow Service Question Pin
aman200624-Aug-04 13:46
aman200624-Aug-04 13:46 
GeneralRe: Window Service Question Pin
Milton Karimbekallil24-Aug-04 18:58
Milton Karimbekallil24-Aug-04 18:58 
GeneralRe: Window Service Question Pin
Stlan25-Aug-04 1:27
Stlan25-Aug-04 1:27 
GeneralRe: Window Service Question Pin
aman200626-Aug-04 7:42
aman200626-Aug-04 7:42 
Hello Mil

Service is started now on win2003, Now i am using the createthread and waitforsingleobject. There is no memory error but now i got one more problem it is giving me the clinet Socket error from the function below. I don't know what is the problem now i did not change any part of code for client request. can u suggest me something.

UINT ClientThread(LPVOID pParam)
{
char buff[MAX_BUFFER_LENGTH];
CString cmd;
CString params;
int n;
BOOL auth=false;
SOCKET client=(SOCKET)pParam;
// send(client,buff,strlen(buff),0);
int nCounter = 0;
CString strData;
CString strFileName;
SYSTEMTIME sysTime;



while(true)
{
n=recv(client,buff,MAX_BUFFER_LENGTH,0);
if(n==SOCKET_ERROR )
{
WriteToLog("Client Socket Error");
break;
}
if(n == 0)
{
//continue;
//if no data recieve exit the loop and close the connection and Client Thread
break;
}
buff[n]=0;
params = (char*)buff;

if(nCounter == 0)
{
nCounter += n;


WriteToLog((LPSTR)(LPCTSTR)params);
GetLocalTime(&sysTime);

strFileName.Format("%s\\User%d%d%d%d%d%d%d.xml",DataFolder,sysTime.wMonth,sysTime.wDay ,sysTime.wYear ,sysTime.wHour ,sysTime.wMinute ,sysTime.wSecond ,sysTime.wMilliseconds );

if(!xmlFile.Open(strFileName,CFile::modeWrite | CFile::modeCreate,NULL))
{

errorMsg.Format("Unable to create %s file",strFileName);
WriteToLog((LPSTR)(LPCTSTR)errorMsg);

}

int nRetVal = params.Find(";",0);
if(nRetVal != -1)
{
cmd = params.Left(nRetVal);
if(n > nRetVal)
{
strData = params.Mid(nRetVal + 1);
{

LPSTR lpstr = (LPSTR)(LPCTSTR)(strData);
xmlFile.Write((PVOID)lpstr,strlen(lpstr));
}



}
}//end nRetVal
else
{
// USES_CONVERSION;
LPSTR lpstr = (LPSTR)(LPCTSTR)(params);
xmlFile.Write((PVOID)lpstr,strlen(lpstr));

}


if(params.Find(ENDXMLTAG) != -1)
{
xmlFile.Close ();
nCounter = 0;
ExecuteDosent(cmd,strFileName);
cmd.MakeUpper();
if(cmd.Compare("DRUSER"))
ExecuteInvokeBat(strFileName);
//break;

}



}//End nCounter
else
{
nCounter += n;
LPSTR lpstr = (LPSTR)(LPCTSTR)(params);
xmlFile.Write((PVOID)lpstr,strlen(lpstr));

if(params.Find(ENDXMLTAG) != -1)
{
xmlFile.Close ();
nCounter = 0;
WriteToLog((LPSTR)(LPCTSTR)params);
ExecuteDosent(cmd,strFileName);
cmd.MakeUpper();
if(cmd.Compare("DRUSER"))
ExecuteInvokeBat(strFileName);
//break;

}



}


}//end of while

closesocket(client);
return 0;
}
thanks
shailesh

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.