471,594 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Terminal Server - Named pipe

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

Nov 16 '05 #1
0 1417

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Aquila Deus | last post: by
3 posts views Thread by EricR | last post: by
reply views Thread by EricR | last post: by
reply views Thread by olaf.dietsche | last post: by
20 posts views Thread by Joel Hedlund | last post: by
3 posts views Thread by Lee T. Hawkins | last post: by
3 posts views Thread by DBC User | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.