Thread: WaitNamedPipe() Issue

  1. #31
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Quote Originally Posted by IndioDoido View Post
    hi BobS0327

    i've changed the error checking code to:
    Code:
    if (hPipe==INVALID_HANDLE_VALUE)
    I still get the same error in the event viewer when i send a command to the server
    But, in the client side i now "trigger" this checking:
    Code:
    	if (!SetNamedPipeHandleState(hPipe,&dwMode,NULL,NULL)) 
    	{
    		printf("CLIENT: Error SetNamedPipeHandleState\n");
    		return 1;
    	}
    As far as the event viewer error code, I would suggest that you call PeekNamedPipe before calling ReadFile to verify that there is actually some data in the pipe for the ReadFile function. If there isn't any data in the pipe then do NOT execute ReadFile.

    How about executing the DisplayError function when SetNamedPipeHandleState fails and post the detailed error message?

  2. #32
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    But, in the client side i now "trigger" this checking:
    Code:
    if (!SetNamedPipeHandleState(hPipe,&dwMode,NULL,NULL)) 
    {
    	printf("CLIENT: Error SetNamedPipeHandleState\n");
    	return 1;
    }
    Sorry about my last this comment, i was wrong, it "triggered" the same checking:
    Code:
    if (hPipe==INVALID_HANDLE_VALUE)
    I called the DisplayError function in that checking, and it showed me this error:
    " \\serverIP\\pipe\\ServNT failed with error 5 (Access is denied) "
    "Artificial Intelligence usually beats natural stupidity."

  3. #33
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Quote Originally Posted by IndioDoido View Post
    Sorry about my last this comment, i was wrong, it "triggered" the same checking:
    Code:
    if (hPipe==INVALID_HANDLE_VALUE)
    I called the DisplayError function in that checking, and it showed me this error:
    " \\serverIP\\pipe\\ServNT failed with error 5 (Access is denied) "
    Are you using an Administrator or non Administartor account on the client workstation? An Administrator login on the client workstation will eliminate the access denied error. Otherwise, if you have to use a non Admin account on the client workstation, you'll have to specify an ACL in the Createfile lpSecurityAttributes parameter. Currently, you're just using the default (NULL) security attributes which grants full control to the LocalSystem account and administrators. They also grant read access to members of the Everyone group and the anonymous account. You fall into the latter group if you're using a non Admin account.

    I would first check with your instructor on this issue prior to fiddling with the ACL's since that may be beyond the scope of your project.

  4. #34
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    i already spoken with my professor, and he said that i need to have admin privileges in both host and virtual machines. And for the pipes to work i have to activate file and printer sharing in both machines, because named pipes work with the same protocol.

    i'm using a admin account in my host and virtual machine. I can access both of them with admin privileges, and they both have file sharing activated.

    The only difference between both machines is the OS. I'm running Vista x64 in the host and WinXP in the virtual.

    "Artificial Intelligence usually beats natural stupidity."

  5. #35
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    The only difference between both machines is the OS. I'm running Vista x64 in the host and WinXP in the virtual.
    I believe the source of your problem may be Vista. I've tested your app under XP Home, XP Pro and Win2k and have not encountered any problems . But when I tested under Vista, I repeatedly encountered the 109 error indicating that the pipe has ended. So, IMHO, it's a Vista issue not an application issue. I have almost no Vista experience, so I can't offer any solutions.

  6. #36
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    DAMMM VISTA!!!

    Tomorrow i'm going to test my app between two winXP OS, and see the results.

    By the way...isn't it strange i can run the client and server app both under vista without having any problems, but when i run the client on vista and the server on a virtual machine running winXP, they don't work?
    "Artificial Intelligence usually beats natural stupidity."

  7. #37
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    To log your account into the virtual from your PC can use

    net use \\<<IP>> /user:<<UID>> <<PWD>>

    Quote Originally Posted by IndioDoido View Post
    By the way...isn't it strange i can run the client and server app both under vista without having any problems, but when i run the client on vista and the server on a virtual machine running winXP, they don't work?
    Are you using remote desktop to connect to the virtual?

    If so make sure you use the command 'mstsc /console' to open only ONE desktop, not one per connection. (not sure if this occurs in XP)
    Other instances of your app may be running in other desktops and causing issues.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #38
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    hey everyone!
    My problem is finally solved

    The problem was with my anti-virus software...yes, it's true. I wasn't able to connect to my virtual machine because i had bit defender installed, and bit defender blocks named pipe transfers...
    I uninstalled the software, set the windows named pipe properties back to normal and...EVERYTHING IS WORKING

    I've learned two things with all this...
    First, never install an anti-virus on a virtual machine. Second, if you don't follow the first rule, don't use bit defender

    Thanks for all the help guys!

    oh...and i owe windows vista an apology, both my applications work fine with it
    "Artificial Intelligence usually beats natural stupidity."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. float calculation issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-26-2008, 04:56 AM
  2. re-entrancy pattern issue setbacks
    By George2 in forum Windows Programming
    Replies: 0
    Last Post: 04-12-2008, 02:23 AM
  3. type safe issue
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2008, 09:32 PM
  4. Idle Issue.
    By Charmy in forum C++ Programming
    Replies: 7
    Last Post: 06-24-2005, 06:10 AM
  5. my first issue of GDM
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-12-2002, 04:02 PM