예제 #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;
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 PlainSocket(Context context, SocketInfo info)
     : base(context, info)
 {
     stream = new PlainSocketStream (this, new IntPtr (info.fd));
     this.state = Socket.SocketState.Open;
 }
예제 #5
0
 public PlainSocket(Context context)
     : base(context)
 {
 }
예제 #6
0
 protected EventedSocket(Context context, SocketInfo info)
     : this(context)
 {
     address = info.Address.ToString ();
     port = info.port;
 }
예제 #7
0
 public EventedSocket(Context context)
     : base(context)
 {
 }
예제 #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);
 }