|
Hi everybody
I am creating an application using VC++ that runs on a terminal server with 30 end users. The end users will use thin clients as front end machines. The application consists of a main menu executeble that opens other executables depending on the user selection. In order to establish that communication I use named pipes. Actually I use 1 named pipe as the main tube for data transfer. What happens is that sometimes the session of any user may freeze and another user may view his data. As a result I have started suspecting that something is wrong with the method that creates the child process and also that at a certain point one user may "use" the name pipe share of the other. The code that performs the above call is:
int CTransfer::StartTalking(CString szNewProcess, CNamedPipe* m_ServerObject, char *pszBuffer)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
char szProcess[128];
strcpy(szProcess , (LPCTSTR)szNewProcess);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
szNewProcess += ".exe";
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
szProcess, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
TRUE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
return 1;
}
#ifndef _DEBUG
if (strlen(pszBuffer))
{
DWORD dwBytesWritten;
if (m_ServerObject->ConnectClient())
m_ServerObject->Write(pszBuffer , strlen(pszBuffer), dwBytesWritten);
}
#endif
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return 0;
}
I am thinking that I could do certain things such as:
1. create 1 named pipe per module in order to distribute traffic to more named pipes.
2. use a CreateMutex before the CreateProcess and Release it before the WaitforSingleObject
I will definitely appreciate any opion or help that you might provide.
Thank you for your time
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
Heloo their i just started c++ n i will wanted to know wich tutorial should i read to learn more about it
tkz again
Guhji
the lost one >.<
|
|
|
|
|
Guhji wrote:
wich tutorial should i read to learn more about it
All?
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
open MSDN and then read it
good luck
hung
|
|
|
|
|
He said tutorials, not reference.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
You should consider learning english before C++!!
|
|
|
|
|
|
Is there an available method or workaround for manipulating the version information of files external to your own application? I've been having trouble with a couple of vendors updating DLL's but not updating their file versions, which is giving our testing people some real headaches. Any suggestions?
"Few people realize the extraordinary effort that many of us exert simply to be normal."
- Albert Camus
|
|
|
|
|
Check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/file_management_functions.asp
Kuphryn
|
|
|
|
|
The MFC doesn't have a method that will manipulate versions. Most other file attributes are accessible but the version is not accessible via the built-in functions. Has anyone else tackled this problem?
|
|
|
|
|
|
|
|
|
I want to shutdown a networked windows 98 computer using the application. How can i do this?
|
|
|
|
|
|
Hello people,
I try to create a little game on my own with VC++6.0.
In a sample, that I loaded from this website, is the header 'dxerr8.h' needed.
Where can I get it?
|
|
|
|
|
|
|
It works ! )
Thank you very much
|
|
|
|
|
Dear all:
I'm writing a com which will be accessed in asp using vc++.I'm not familiar with atl,so mfc is my only choice.I'm a beginner,so I do it step by step.I used appwizard to create a standard mfc dll with automation enabled.I created a new class CMyobj which inherited from CCmdtarget.The automation option I selected for CMyobj is createable by type id.Now I add a method
BSTR GetNameById(LPCTSTR ID)
My first question is if I can call this method directly in ASP like this:
DIM OBJ
DIM ID
DIM Name
obj = server.createobject("Myobj")
Name= obj.GetNameById(ID)
If I can't,what else should I code.(I am a step by step)
I also waht to add a method to return one(or more) recordset(s).How to declare the parameter type for recordset.My declaration is
LPDISPATCH GetNameByDept(long dept)
In the implimentation of this method,I create a recordset,retrieve the data,cast the recordset to (IDISPATCH *).The code is like this:
_Recordsetptr pRs;
pRs->createinstance(__uuidof(recordset))
....
pRs->open(sql,connection_string,...)
return (IDISPATCH *)pRs->Detach()
I create a c++ client and call the method like this:
_Recordsetptr pRs;
long deptid;
pRs = IObjinterface->GetNameByDept(deptid)
It works in c++.But i think it may be a little lucky.It doesn't work in asp.Asp code may be like this:
dim rs
dim obj
dim dept
set rs=server.createobject('adodb.recordset')
set obj=server.createobject('myobj')
rs=obj.GetNameByDept(dept)
rs.open
....
set rs=nothing
set obj=nothing
Can somebody give me some help?example codes,articles,urls or books.
|
|
|
|
|
I recommend these books on COM and ATL.
Inside COM (Programming Series) by Dale Rogerson
Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen
Kuphryn
|
|
|
|
|
Hi everyone!
Is there anyone that has implement a multicast program on c++, that join a multicast group.
When it had join a group it will logg traffic and saves it in a circular buffer.
But first I will have some help with joining a multicast group.
Please help me,
Stefan
|
|
|
|
|
|
Code to Join:
<br />
struct ip_mreq mreq;<br />
{<br />
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
}<br />
<br />
#define RECV_IP_ADDR "225.6.7.8" // An arbitrary multicast address<br />
<br />
mreq.imr_multiaddr.s_addr = inet_addr(RECV_IP_ADDR);<br />
mreq.imr_interface.s_addr = INADDR_ANY;<br />
err = setsockopt(<br />
sock, <br />
IPPROTO_IP,<br />
IP_ADD_MEMBERSHIP,<br />
(char*)&mreq, <br />
sizeof(mreq));<br />
<br />
Igor Proskuriakov
|
|
|
|