racette
November 14th, 2007, 10:57 AM
Hi gurus!
Im developping two softwares that need to communicate with each other over a network. The IPC mechanism we chose is the named pipes. Both softwares are being developped in C++.
When I did my preliminary tests, everything went fine but performance was not that good. I read that I needed to send and receive data asynchronously, which made sense to me.
So I changed everything to incorporate asynchronous overlapped I/O.
Here is what my softwares do:
Software A creates about a dozen named pipes.
Software B connects to those pipes.
Now, software A sends data through pipe #1. Pipe #1 was designed to send and receive blocks of 112 bytes. This data is received correctly by software B.
Up to here, everything is ok.
Then, software A sends data through pipe #2. Pipe #2 was designed to send and receive blocks of 153,268 bytes. This data is NOT received correctly by software B.
When I do my tests locally (on one pc running both softwares), this block of 153,268 bytes is sent and received correctly.
So my assumption is that there is something wrong with sending and receiving large blocks of data through named pipes over a network.
I read on different forums that there is a limit on the size of data that can be sent through named pipes over a network.
I tried everything I could find on the Internet, but didnt find anything that would work.
My questions are:
If a ReadFile or WriteFile call returns false, and that GetLastError() returns ERROR_IO_PENDING, what should I do to make sure the data is written or read entirely?
Should I call GetOverlappedResult()?
Does a call to GetOverlappedResult() keeps on reading or writing or should I call WriteFile or ReadFile again and again until its done?
Should I wait for the event that was specified to the Overlapped structure?
If someone asks, I can post the code I use.
Thanks.
Im developping two softwares that need to communicate with each other over a network. The IPC mechanism we chose is the named pipes. Both softwares are being developped in C++.
When I did my preliminary tests, everything went fine but performance was not that good. I read that I needed to send and receive data asynchronously, which made sense to me.
So I changed everything to incorporate asynchronous overlapped I/O.
Here is what my softwares do:
Software A creates about a dozen named pipes.
Software B connects to those pipes.
Now, software A sends data through pipe #1. Pipe #1 was designed to send and receive blocks of 112 bytes. This data is received correctly by software B.
Up to here, everything is ok.
Then, software A sends data through pipe #2. Pipe #2 was designed to send and receive blocks of 153,268 bytes. This data is NOT received correctly by software B.
When I do my tests locally (on one pc running both softwares), this block of 153,268 bytes is sent and received correctly.
So my assumption is that there is something wrong with sending and receiving large blocks of data through named pipes over a network.
I read on different forums that there is a limit on the size of data that can be sent through named pipes over a network.
I tried everything I could find on the Internet, but didnt find anything that would work.
My questions are:
If a ReadFile or WriteFile call returns false, and that GetLastError() returns ERROR_IO_PENDING, what should I do to make sure the data is written or read entirely?
Should I call GetOverlappedResult()?
Does a call to GetOverlappedResult() keeps on reading or writing or should I call WriteFile or ReadFile again and again until its done?
Should I wait for the event that was specified to the Overlapped structure?
If someone asks, I can post the code I use.
Thanks.