Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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
GeneralCreating an custom dos stub Pin
Vilo99924-Aug-04 13:02
Vilo99924-Aug-04 13:02 
GeneralRe: Creating an custom dos stub Pin
Ryan Binns24-Aug-04 18:23
Ryan Binns24-Aug-04 18:23 
GeneralRe: Creating an custom dos stub Pin
Vilo99925-Aug-04 0:27
Vilo99925-Aug-04 0:27 
GeneralRe: Creating an custom dos stub Pin
David Crow25-Aug-04 3:28
David Crow25-Aug-04 3:28 
GeneralCan't get CScrollView to scroll properly Pin
cyclonez24-Aug-04 11:12
cyclonez24-Aug-04 11:12 
GeneralAccessing Structures Pin
Zero_G24-Aug-04 10:45
Zero_G24-Aug-04 10:45 
GeneralRe: Accessing Structures Pin
palbano24-Aug-04 11:11
palbano24-Aug-04 11:11 
GeneralCast to int * Pin
Anonymous24-Aug-04 10:25
Anonymous24-Aug-04 10:25 
GeneralRe: Cast to int * Pin
Ravi Bhavnani24-Aug-04 10:55
professionalRavi Bhavnani24-Aug-04 10:55 
GeneralRe: Cast to int * Pin
palbano24-Aug-04 11:17
palbano24-Aug-04 11:17 
GeneralRe: Cast to int * Pin
Ravi Bhavnani24-Aug-04 11:32
professionalRavi Bhavnani24-Aug-04 11:32 
GeneralRe: Cast to int * Pin
Anonymous25-Aug-04 2:16
Anonymous25-Aug-04 2:16 
GeneralRe: Cast to int * Pin
Anonymous25-Aug-04 3:28
Anonymous25-Aug-04 3:28 
GeneralRe: Cast to int * Pin
Henry miller25-Aug-04 3:50
Henry miller25-Aug-04 3:50 
GeneralRe: Cast to int * Pin
Anonymous25-Aug-04 4:55
Anonymous25-Aug-04 4:55 
GeneralRe: Cast to int * Pin
Henry miller26-Aug-04 2:58
Henry miller26-Aug-04 2:58 
GeneralMysql connect help Pin
Linera24-Aug-04 10:03
Linera24-Aug-04 10:03 

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.