Exemplo n.º 1
0
 public override void onIo(MamaIo io, mamaIoType ioType)
 {
     if (!example_.quiet)
     {
         Console.WriteLine("EXCEPT");
     }
 }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 // called too many times, debug output disabled
 public override void onIo(MamaIo io, mamaIoType ioType)
 {
 }
Exemplo n.º 5
0
 public abstract void onIo(MamaIo io, mamaIoType ioType);
Exemplo n.º 6
0
			public override void onIo(MamaIo io, mamaIoType ioType)
			{
				if (!example_.quiet)
				{
					Console.WriteLine("EXCEPT");
				}
			}
Exemplo n.º 7
0
			// called too many times, debug output disabled
			public override void onIo(MamaIo io, mamaIoType ioType)
			{
			}
Exemplo n.º 8
0
			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);
			}
Exemplo n.º 9
0
			public abstract void onIo(MamaIo io, mamaIoType ioType);
Exemplo n.º 10
0
		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);
			}
		}