public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
        {
            GenericResponse response = null;

            lock (this)
            {
                try
                {
                    _database.Write(IscCodes.op_service_attach);
                    _database.Write(0);
                    _database.Write(service);
                    _database.WriteBuffer(spb.ToArray());
                    _database.Flush();

                    response = _database.ReadGenericResponse();

                    _handle = response.ObjectHandle;
                }
                catch (IOException)
                {
                    _database.Detach();

                    throw new IscException(IscCodes.isc_net_write_err);
                }
            }
        }
示例#2
0
        public void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service)
        {
            GenericResponse response = null;

            lock (this)
            {
                try
                {
#warning Separate method for op_service_attach as for i.e. op_attach
                    _database.XdrStream.Write(IscCodes.op_service_attach);
                    _database.XdrStream.Write(0);
                    _database.XdrStream.Write(service);
                    _database.XdrStream.WriteBuffer(spb.ToArray());
                    _database.XdrStream.Flush();

                    response = _database.ReadGenericResponse();

                    _handle = response.ObjectHandle;
                }
                catch (IOException ex)
                {
                    _database.Detach();
                    throw IscException.ForErrorCode(IscCodes.isc_net_write_err, ex);
                }
            }
        }
示例#3
0
 public override void Attach(ServiceParameterBufferBase spb, string dataSource, int port, string service, byte[] cryptKey)
 {
     try
     {
         SendAttachToBuffer(spb, service);
         _database.Xdr.Flush();
         ProcessAttachResponse((GenericResponse)_database.ReadResponse());
     }
     catch (IOException ex)
     {
         _database.Detach();
         throw IscException.ForIOException(ex);
     }
 }
 public virtual void Attach(ServiceParameterBuffer spb, string dataSource, int port, string service, byte[] cryptKey)
 {
     try
     {
         SendAttachToBuffer(spb, service);
         _database.Xdr.Flush();
         ProcessAttachResponse(_database.ReadResponse <GenericResponse>());
     }
     catch (IOException ex)
     {
         _database.Detach();
         throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
     }
 }
示例#5
0
        public virtual async Task Attach(ServiceParameterBuffer spb, string dataSource, int port, string service, byte[] cryptKey, AsyncWrappingCommonArgs async)
        {
            try
            {
                await SendAttachToBuffer(spb, service, async).ConfigureAwait(false);

                await _database.Xdr.Flush(async).ConfigureAwait(false);
                await ProcessAttachResponse((GenericResponse)await _database.ReadResponse(async).ConfigureAwait(false), async).ConfigureAwait(false);
            }
            catch (IOException ex)
            {
                await _database.Detach(async).ConfigureAwait(false);

                throw IscException.ForErrorCode(IscCodes.isc_network_error, ex);
            }
        }