PipeStream (NamedPipe) Read existing Pipe Problem with EndRead/ no timeout

Hi

Please help me with System.IO.Pipes;

i use
  this.pipe = new NamedPipeClientStream(".", "S036X",
PipeDirection.InOut, PipeOptions.Asynchronous);
  pipe.Connect(200);

to connect an existing Pipe which is provided by an 3rd party
Application.

Connecting, Writing and reading the pipe works mostly fine.

But !! sometimes reading the Pipe blocks my App.
I think it happend when the pipe is empty (i can force it reading the
pipe right after pipe.Connect(), without sending a command to the pipe-
Server)

is there a possibility to find out whether data present in the pipe ?

I try

sr = new StreamReader(pipe);
string data = sr.ReadToEnd();

or.

  IAsyncResult ar = pipe.BeginRead(buffer, 0, 255, null, null);
  if (ar.AsyncWaitHandle.WaitOne(1000) == true)
  {
          // ok if Data Present
          int read = pipe.EndRead(ar);
          ......
 }
else
{
           // cont. here after 1000 ms but pipe.EndRead... blocks the
App !!
           // msdn says EndRead must be calle for each BeginRead
          pipe.EndRead(ar);
}

------

setting pipe.ReadTimeout = 1000    is not supportet.
reading pipe.Length is not supported.

What can I do. ?

Thank you.
Peter








0
Peter
4/14/2010 9:32:17 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

0 Replies
2376 Views

Similar Articles

[PageSpeed] 24

Reply:

Similar Artilces:

Created Excel files are read-only
All Excel files on my RW-CDs became read-only when opened and all newly created files are read-only when filed to disc. Why is this occurring and how do I eliminate this from happening? If files are saved to hard drive, this does not occur. Hi one should never save/open Excel files directly from a removable storage medium. This could lead to file corruptions quite easily. So always best to copy the files first to your harddisc -- Regards Frank Kabel Frankfurt, Germany "Bales" <Bales@discussions.microsoft.com> schrieb im Newsbeitrag news:2BBB63E6-4313-4AC2-ACE7-C119A2FF...

Why can I read other peoples e-mail, when I log on to their wor.
When I log on tooutlook 2003 at workstation where my co-worker is the Administrator, I get his e-mail. I only have domain user privileges. did you create your own profile? "MEDS" <MEDS@discussions.microsoft.com> wrote in message news:DD6804C0-BF21-4395-9C1C-5E7E4C7388D2@microsoft.com... > When I log on tooutlook 2003 at workstation where my co-worker is the > Administrator, I get his e-mail. I only have domain user privileges. Thanks for responding Diane. I created my own profile. "Diane Poremsky [MVP]" wrote: > did you create your own profile? >...

read mail at two locations
i have my mail set up to be read at work and home. i receive mail daily at work, but can not read the mail at home. i hve set up all the appropriate properties, but i can not receive the mail i got today at work at home tonight. any suggestions? On Thu, 8 Apr 2004 20:28:21 -0700, "stacystudr@aol.com" <anonymous@discussions.microsoft.com> wrote: >i have my mail set up to be read at work and home. i >receive mail daily at work, but can not read the mail at >home. i hve set up all the appropriate properties, but i >can not receive the mail i got today at work ...

Print problems
For publishing a company catalogue I have chosen a template with a single start page, single end page and inbetween double sided pages obviously placed there for some kind of convenience for later laminating or stapling. My problem is that, instead of relying on my copyshop ready-printed ones, I want to be able to print this out at the company as well when I need a copy, but then double sided! My color laser is set to print duplex, so that part is 100% ok. Why does the document still print out as single-sided? What have I done wrong? Should I choose another template that is already se...

Database is Read-Only for users without administrative rights
I have recently set up a multiuser database with a front end on each users workstation and the back end on the server. All users are forced to use the front end in Access 2007 Runtime mode. The system has been tested for several weeks and worked fine in a branch office where all users are at administrator level. When I transferred the database to our head office I discovered that standard users (i.e users, mobile users or power users) receive a warning message that the database has been opened in read only mode. Whilst these users are able to edit most of the data on the forms and que...

PipeStream (NamedPipe) Read existing Pipe Problem with EndRead/ no timeout
Hi Please help me with System.IO.Pipes; i use this.pipe = new NamedPipeClientStream(".", "S036X", PipeDirection.InOut, PipeOptions.Asynchronous); pipe.Connect(200); to connect an existing Pipe which is provided by an 3rd party Application. Connecting, Writing and reading the pipe works mostly fine. But !! sometimes reading the Pipe blocks my App. I think it happend when the pipe is empty (i can force it reading the pipe right after pipe.Connect(), without sending a command to the pipe- Server) is there a possibility to find out whether data pres...

Exchange 2003 Connectivity Problems with latest hotfixes
LATEST HOTFIXES..... KB890859 KB890923 KB893086 KB893066 KB842773 Causes intermittent connection problems to webmail and client connections to exchange. Be careful with these hotfixes as they are now available on Windows Update. I applied them this weekend and had about 60 percent of my client connections fail to the exchange server. Webmail also broke. I uninstalled the hotifixes and rebooted my cluster nodes. Once I completed the reboots everything returned to normal. Jeff Lucal Senior Engineer ...

Problem using MAPIOBJECT from calendar item
I have a program that uses the Outlook Object Model to gather info from a calendar. Since upgrading to Outlook 2003 I am trying to avoid the Outlook Object Security warning dialog when I get the calendar item body. I am trying to use the GetMAPIOBJECT() method of the AppointmentItemPtr to see if using that interface will allow me to get the body text without the warning. I have tried two methods for the mapiobject; coerce the returned point into an IMessage pointer and do a QueryInterface() on the returned IUnknown pointer. Neither succeeds. If I coerce the pointer I get an exception when ...

Date format problem
In my Excel files,when I click a cell that contain "date" it changes into dd/mm/yyyy format.But,in the formula bar,the same date is displayed in mm/dd/yyyy format.Why it is so? I want all the dates in dd/mm/yyyy format only.Will there be any problem while sorting if the date column contais dates of different formats i.e. dd/mm/yyyy and mm/dd/yyyy as well? You can check the cells format for date format and choose a date format that has a * in front of it this doesnt change with system settings, you should also check your computers language setting and check the settings in...

XmlValidatingReader and number of Reads
Greetings, Does anyone know how to approximate the number of reads that will be involved in validating an XML file against it's XSD? I want to update my progress bar as there are going to likely be several hundred thousand iterations. Thanks, Ian Williamson ...

WIERD Excel Problem
Hi ALL I have this user that says when she opens Excel the only options she has is to go into File or View. She has no Tools, Help, etc. She has reinstalled Excel to no avail. Has anyone ever seen or heard of this?? Thanks Close excel, do a file search in windows for *.xlb, (depending on excel version it differs a bit but for instance Excel10.xlb is for excel 2002), make sure you have the options of searching hidden files and folders turned on (there is always a xlb file), rename or delete it, restart excel. That will create a new menu file -- Regards, Peo Sjoblom Northwest E...

read only file-need to write
I've rec'd a read only excel file on my pc which I need to copy to a CD-RW and then take to a meeting with my laptop and add info to it and save. Then someone else will take the CD-RW w/saved info and manipulate it on their own PC. I do not have email/online on my laptop. The file says read only. Copied it to my CD as write. But still when I get it to the CD-RW it ends up read only. I can add material but it won't change it or allow it to be saved w/another name. What am I doing wrong? How can I accomplish what I need to do. I need to do it tonight at 7pm CA/USA time. -- ju...

There was an error reading the rules from the server.
I received the following error when opening Outlook 2000: 'There was an error reading the rules from the server. The format of the server rules was not recognized'. I have checked there are no rules set in the rules wizard. The server is running Exchange 2000. I tried outlook.exe /cleanrules but no good. I have searched on the Microsoft site and on here, but can't find any reference to this error. Has anyone ever come across it before? How should I take out any server-side rules from Exchange server itself? I haven't done it before. Thanks! There are a couple of tool...

Problem with XML file?
I'm using the following code to create an Xml document to be saved by the browser (IE): MemoryStream stream = new MemoryStream(); OrderManager.ExportToXml(stream); // Creates Xml by using XmlTextWriter to the stream Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=BaldrianOrdersMamut.xml"); Response.BinaryWrite(stream.GetBuffer()); Response.End(); This is a sample of the saved Xml file: <?xml version="1.0" encoding="utf-8"?> <GBAOX10...

Read
Lady only 24-Hrs +91 9810577227 Send email to info@lenstar.org get access code. ...

How to read and write Excel XMLSS in Visual Basic.NET
Hi all, How would you read and write XMLSS files in VB.NET? I'm developing a Windows Forms Application and want to export data from datasets. Need a bit more Spreadsheet formatting than just writing the dataset to XML. My first approach is to create a new XMLDocument and manually add the attributes and child nodes. But i'm not very satisfied with it. I searched MSDN for some XMLSS object model but did not find one. Should I create my own serializable classes representing the Spreadsheet XML model? How to customize the Serialization to generate XMLSS? I'm a newbie in XML; just ...

Prob after reading notes
When I try to close outlook (2002 SP3 on XP) after viewing a note I get the following dialog box reporting an error: Could not complete the operation. One or more parameter values are not valid. If I click 'OK' I get a warning that my note will not be saved (it was). If I try to close Outlook again, sometimes it closes and sometimes is provides a repeat performance of the invalid parameter values routine. I am guessing a file with my notes information is corrupted but I don't know what to do. TIA, Ralph Page Have you tried to run a detect and repair from the Help menu? -- ...

Is there way way to prevent the reading pane from starting in Outlook
I want to permenatley disable to in Outlook. Any Ideas? have a look here: http://www.outlook-tips.net/howto/commandlines.htm -- You forgot to mention your version...... here are some tips about how to post questions: http://support.microsoft.com/?id=555375 Regards Judy Gleeson MVP Outlook Trainer and Consultant There are various articles about using Outlook here: www.judygleeson.com/articles.aspx Canberra, Australia "What do we live for, if it is not to make life less difficult for each other?" George Eliot <mingoringo@roadrunner.com> wrote in message news:690f8e5f-...

Remove Prompt to Open File as Read-Only (Excel 2007)
I have an Excel file that was created using Excel 2003. The person who created the file set protection so that every time the file is opened, a window appears with the following message: "'filename' should be opened as read-only unless you need to save changes to it. Open as read-only?" I am using Excel 2007 and want to remove this prompt, but when I go to the Help function for instructions on how to do it, it provides names of menu/ribbon options that don't exist (see below): 1. On the Review tab, click Protect Document. 2. Select Restrict Formatti...

XmlNode and read as BinHex
Hi, I'm processing a document using XmlDocument and I have an XmlNode whose value is stored as a binhex encoded string... How can I get this string converted back to a byte[]... XmlConvert has some internal methods but is there no public .net framework classes or methods that will do this... Thanks Donal Hi Donal, You can use a static method XmlConvert.FromBinHexString to convert the BinHex encoded string to byte[]. You can check the following link for more information on this method. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfsystem...

Writing to and reading from same file = crash :(
Hi, I am running 2 modaless windows. One which is writing to a file (opened in share mode), the other reading from that file. After running for a while successfully (about 30 seconds), my program crashes. I have a feeling my program is crashing at the part where I'm trying to read the file. Basically I am reading line by line from the file, tokenizing each line (by its tab) and putting each item (3 numbers separated by tab) into a CArray. Do you see anything wrong with what's below? : while(src.ReadString(strLine) { while(AfxExtractSubString(resToken, strLine, s, _T('...

Problem installing Office v.X *UPGRADE* version on Panther
I recently upgraded from my old WallStreet (PowerBook/G3) running Jaguar (MacOS 10.2.8) to a new PowerBook/G4 15" running Panther (MacOS 10.3.1). Today, I tried to install my existing copy of Microsoft Office v.X onto the new PowerBook (as I retire the old PowerBook). (In brief, I: 1) removed the "Office Test Drive"; 2) installed Office/98; 3) installed Office v.X.) All went well until I tried to launch Office v.X for the first time. When it came to the screen where I was to browse for the "qualifying old version" so that Office could verify that I was a valid upgra...

More Rules Problems
"There was an error reading the rules from the server. The format of the server rules was not recognized. The operation failed. An object could not be found." My users are getting this error every time they open Outlook 2003. I am running Exchange 2003, and the Information store used was backed up from another server with a different name. I have applied the hotfix from kb 840007, and although it helped, we still get these errors, and are unable to create new rules on the server. Does anyone know if I can remove the rules from the server and start clean? How would I go about...

M2004 (No MSN, no Passport) -> M2006 Any problems?
I use M2004 without MSN, Passport or passwords. My financial institutions (Citi cards, Fidelity, Bank One) download into M2004 without any problems. Will I be able to transition into M2006 without any problems? I'll be happy to maintain the current M2004 features and capabilities. I'm thinking of M2006 only because the on-line stuff for M2004 will expire next year. -- Aloke ---- to reply by e-mail remove 123 and change invalid to com In microsoft.public.money, Aloke Prasad wrote: >I use M2004 without MSN, Passport or passwords. My financial institutions >(Citi card...

Junk mail filter instillation problem
The operating system is Windows XP Home with all the Microsoft updates. The office program also is current, with one major exception. I bought a copy of Outlook 2003 some time a ago, and installed it in place of Outlook 2002. I have been unsuccessful in attempting to install over and over again the recently released December 2005 junk mail filter update. I even shut down the Kaspersky anti-virus and the Outpost firewall in some of my attempts to install this update. How do I install this latest junk mail filter. Thanks ...