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); }
private void CreateIoHandlers() { try { uint descriptor = (uint)client.Handle; readHandler = new MamaIo(); readHandler.create(defaultQueue, new ReadIoCallback(this), descriptor, mamaIoType.MAMA_IO_READ); writeHandler = new MamaIo(); writeHandler.create(defaultQueue, new WriteIoCallback(this), descriptor, mamaIoType.MAMA_IO_WRITE); try { exceptHandler = new MamaIo(); exceptHandler.create(defaultQueue, new ExceptIoCallback(this), descriptor, mamaIoType.MAMA_IO_EXCEPT); } catch (MamaException e) { Console.WriteLine("Warning: Cannot create IO Handler for MAMA_IO_EXCEPT: not supported on current middleware: {0}", e.ToString()); } } catch (MamaException e) { Console.WriteLine("Error creation IO Handler: {0}", e.ToString()); Exit(1); } }
// called too many times, debug output disabled public override void onIo(MamaIo io, mamaIoType ioType) { }
public abstract void onIo(MamaIo io, mamaIoType ioType);
private void CreateIoHandlers() { try { uint descriptor = (uint)client.Handle; readHandler = new MamaIo(); readHandler.create(defaultQueue, new ReadIoCallback(this), descriptor, mamaIoType.MAMA_IO_READ); writeHandler = new MamaIo(); writeHandler.create(defaultQueue, new WriteIoCallback(this), descriptor, mamaIoType.MAMA_IO_WRITE); exceptHandler = new MamaIo(); exceptHandler.create(defaultQueue, new ExceptIoCallback(this), descriptor, mamaIoType.MAMA_IO_EXCEPT); } catch (MamaException e) { Console.WriteLine("Error creation IO Handler: {0}", e.ToString()); Exit(1); } }