예제 #1
0
		public IAsyncResult BeginClose ()
		{
			TransparentStreamCloseRequestMessage request = new TransparentStreamCloseRequestMessage (Guid.NewGuid (), streamID);
			TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null);
			if (!pendingCloseRequests.TryAdd (request.ID, result)) {
				throw new Exception ("request failed before sending.");
			}
			objectBusSession.SendMessage (request);
			return result;
		}
예제 #2
0
		public IAsyncResult BeginSetReadTimeout (int value)
		{
			TransparentStreamSetReadTimeoutRequestMessage request = new TransparentStreamSetReadTimeoutRequestMessage (Guid.NewGuid (), streamID, value);
			TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null);
			if (!pendingSetReadTimeoutRequests.TryAdd (request.ID, result)) {
				throw new Exception ("request failed before sending.");
			}
			objectBusSession.SendMessage (request);
			return result;
		}
예제 #3
0
		public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
		{
			TransparentStreamReadRequestMessage request = new TransparentStreamReadRequestMessage (Guid.NewGuid (), streamID, count);
			TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (callback, state);
			if (!pendingReadRequests.TryAdd (request.ID, new Tuple <TransparentStreamAsyncResult, byte[], int, int> (result, buffer, offset, count))) {
				throw new Exception ("request failed before sending.");
			}
			objectBusSession.SendMessage (request);
			return result;
		}
예제 #4
0
		public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
		{
			byte[] nbuf = new byte[count];
			System.Buffer.BlockCopy (buffer, offset, nbuf, 0, count);
			TransparentStreamWriteRequestMessage request = new TransparentStreamWriteRequestMessage (Guid.NewGuid (), streamID, nbuf);
			TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null);
			if (!pendingWriteRequests.TryAdd (request.ID, result)) {
				throw new Exception ("request failed before sending.");
			}
			objectBusSession.SendMessage (request);
			return result;
		}
예제 #5
0
		public IAsyncResult BeginSeek (long offset, System.IO.SeekOrigin origin)
		{
			TransparentStreamSeekRequestMessage request = new TransparentStreamSeekRequestMessage (Guid.NewGuid (), streamID, offset, origin);
			TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null);
			if (!pendingSeekRequests.TryAdd (request.ID, result)) {
				throw new Exception ("request failed before sending.");
			}
			objectBusSession.SendMessage (request);
			return result;
		}