public override void onIo(MamaIo io, mamaIoType ioType) { if (!example_.quiet) { Console.WriteLine("EXCEPT"); } }
public override void onIo(MamaIo io, mamaIoType ioType) { Socket sock = example_.client; byte [] buffer = new byte[1024]; int len = sock.Receive(buffer, 1023, SocketFlags.None); buffer[len] = (byte)'\0'; string text = Encoding.ASCII.GetString(buffer, 0, len); if (!example_.quiet) { Console.WriteLine("READ: {0}", text); } // should test for "quit", but Windows' telnet client won't send it // no matter if "set mode stream" was used and would send only partial // substrings, such as "q", then "uit", "qu", then "it", etc. if (text.StartsWith("q")) { Console.WriteLine("QUITING"); Mama.stop(MamaIoCS.bridge); return; } sock.Send(buffer, len, SocketFlags.None); }
/// <summary> /// Create an IO handler. /// </summary> /// <remarks> /// If the underlying infrastructure does not support the requested mamaIoType, /// create throws MamaException(MAMA_STATUS_UNSUPPORTED_IO_TYPE). For example, /// RV only supports READ, WRITE, and EXCEPT. LBM supports all types except ERROR /// </remarks> /// <param name="queue">The event queue for the io events. null specifies the /// Mama default queue</param> /// <param name="action">The callback to be invoked when an event occurs.</param> /// <param name="descriptor">Wait for IO on this descriptor.</param> /// <param name="ioType">Wait for occurences of this type.</param> /// <param name="closure">The closure that is passed to the callback.</param> public void create( MamaQueue queue, MamaIoCallback action, uint descriptor, mamaIoType ioType, object closure) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (action == null) { throw new ArgumentNullException("action"); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS this.callback = action; this.closureObject = closure; IntPtr queueHandle = queue != null ? queue.NativeHandle : IntPtr.Zero; int code = NativeMethods.mamaIo_create( ref nativeHandle, queueHandle, descriptor, mIoDelegate, (int)ioType, IntPtr.Zero); CheckResultCode(code); GC.KeepAlive(queue); }
/// <summary> /// CLS compliant version of create /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/> /// </summary> public void create( MamaQueue queue, MamaIoCallback action, long descriptor, mamaIoType ioType) { create(queue, action, descriptor, ioType, null); }
/// <summary> /// CLS compliant version of create /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/> /// </summary> public void create( MamaQueue queue, MamaIoCallback action, long descriptor, mamaIoType ioType, object closure) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (descriptor < 0 || descriptor > UInt32.MaxValue) { throw new ArgumentOutOfRangeException("descriptor", descriptor); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS create(queue, action, (uint)descriptor, ioType, closure); }
// called too many times, debug output disabled public override void onIo(MamaIo io, mamaIoType ioType) { }
public abstract void onIo(MamaIo io, mamaIoType ioType);
/// <summary> /// CLS compliant version of create /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/> /// </summary> public void create( MamaQueue queue, MamaIoCallback action, long descriptor, mamaIoType ioType) { create(queue, action, descriptor, ioType, null); }
/// <summary> /// Create an IO handler. /// </summary> /// <remarks> /// If the underlying infrastructure does not support the requested mamaIoType, /// create throws MamaException(MAMA_STATUS_UNSUPPORTED_IO_TYPE). For example, /// RV only supports READ, WRITE, and EXCEPT. LBM supports all types except ERROR /// </remarks> /// <param name="queue">The event queue for the io events. null specifies the /// Mama default queue</param> /// <param name="action">The callback to be invoked when an event occurs.</param> /// <param name="descriptor">Wait for IO on this descriptor.</param> /// <param name="ioType">Wait for occurences of this type.</param> /// <param name="closure">The closure that is passed to the callback.</param> public void create( MamaQueue queue, MamaIoCallback action, uint descriptor, mamaIoType ioType, object closure) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (action == null) { throw new ArgumentNullException("action"); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS this.callback = action; this.closureObject = closure; IntPtr queueHandle = queue != null ? queue.NativeHandle : IntPtr.Zero; int code = NativeMethods.mamaIo_create( ref nativeHandle, queueHandle, descriptor, mIoDelegate, (int)ioType, IntPtr.Zero); CheckResultCode(code); GC.KeepAlive(queue); }
/// <summary> /// CLS compliant version of create /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/> /// </summary> public void create( MamaQueue queue, MamaIoCallback action, long descriptor, mamaIoType ioType, object closure) { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (descriptor < 0 || descriptor > UInt32.MaxValue) { throw new ArgumentOutOfRangeException("descriptor", descriptor); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS create(queue, action, (uint)descriptor, ioType, closure); }
public override void onIo(MamaIo io, mamaIoType ioType) { if (!example_.quiet) { Console.WriteLine("EXCEPT"); } }
// called too many times, debug output disabled public override void onIo(MamaIo io, mamaIoType ioType) { }
public override void onIo(MamaIo io, mamaIoType ioType) { Socket sock = example_.client; byte [] buffer = new byte[1024]; int len = sock.Receive(buffer, 1023, SocketFlags.None); buffer[len] = (byte)'\0'; string text = Encoding.ASCII.GetString(buffer, 0, len); if (!example_.quiet) { Console.WriteLine("READ: {0}", text); } // should test for "quit", but Windows' telnet client won't send it // no matter if "set mode stream" was used and would send only partial // substrings, such as "q", then "uit", "qu", then "it", etc. if (text.StartsWith("q")) { Console.WriteLine("QUITING"); Mama.stop(MamaIoCS.bridge); return; } sock.Send(buffer, len, SocketFlags.None); }
public abstract void onIo(MamaIo io, mamaIoType ioType);