Beispiel #1
0
 FileStream(Context context, IntPtr handle, int blockSize, bool canRead, bool canWrite)
     : base(context)
 {
     this.Handle = handle;
     this.readBuffer = new byte [blockSize];
     this.canRead = canRead;
     this.canWrite = canWrite;
 }
Beispiel #2
0
        protected EventedStream(Context context, IntPtr handle)
            : base(context)
        {
            if (handle == IntPtr.Zero)
                throw new ArgumentException ("handle");

            this.Handle = handle;

            this.readWatcher = new IOWatcher (Handle, EventTypes.Read, Context.Loop, HandleReadReady);
            this.writeWatcher = new IOWatcher (Handle, EventTypes.Write, Context.Loop, HandleWriteReady);
        }
Beispiel #3
0
        public static FileStream Open(Context context, string fileName, int blockSize,
			OpenFlags openFlags)
        {
            var fd = Syscall.open (fileName, openFlags,
                FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | FilePermissions.S_IROTH);
            var mask = OpenFlags.O_RDONLY | OpenFlags.O_RDWR | OpenFlags.O_WRONLY;
            var canRead = (openFlags & mask) == OpenFlags.O_RDONLY
                || (openFlags & mask) == OpenFlags.O_RDWR;
            var canWrite = (openFlags & mask) == OpenFlags.O_WRONLY
                || (openFlags & mask) == OpenFlags.O_RDWR;
            return new FileStream (context, new IntPtr (fd), blockSize, canRead, canWrite);
        }
Beispiel #4
0
 PlainSocket(Context context, SocketInfo info)
     : base(context, info)
 {
     stream = new PlainSocketStream (this, new IntPtr (info.fd));
     this.state = Socket.SocketState.Open;
 }
Beispiel #5
0
 public PlainSocket(Context context)
     : base(context)
 {
 }
Beispiel #6
0
 protected EventedSocket(Context context, SocketInfo info)
     : this(context)
 {
     address = info.Address.ToString ();
     port = info.port;
 }
Beispiel #7
0
 public EventedSocket(Context context)
     : base(context)
 {
 }
Beispiel #8
0
 public static FileStream Create(Context context, string fileName, int blockSize)
 {
     return Open (context, fileName, blockSize,
         OpenFlags.O_RDWR | OpenFlags.O_CREAT | OpenFlags.O_TRUNC);
 }