public static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: UnsolClient <service> <message>"); Environment.Exit(1); } string service = args[0]; string message = args[1]; TPINIT tpinfo = new TPINIT(); tpinfo.cltname = "sample"; ATMI.tpinit(tpinfo); try { ATMI.tpsetunsol(new UnsolHandler(tpunsol)); try { ByteBuffer data = StringUtils.NewStringBuffer(message); try { Console.WriteLine("Sending '" + message + "' to service " + service); int cd = ATMI.tpacall(service, data, 0, 0); WaitForMessages(10); int len; ATMI.tpgetrply(ref cd, ref data, out len, 0); message = StringUtils.ReadStringBuffer(data, len); Console.WriteLine("Returned string is: " + message); } finally { ATMI.tpfree(data); } } finally { ATMI.tpsetunsol(null); } } finally { ATMI.tpterm(); } }
public static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: SimpleAsyncClient <message>"); Environment.Exit(1); } string message = args[0]; ATMI.tpinit(null); try { int cd; ByteBuffer sendbuf = StringUtils.NewStringBuffer(message); try { Console.WriteLine("Sending '" + message + "' to service TOUPPER"); cd = ATMI.tpacall("TOUPPER", sendbuf, 0, 0); } finally { ATMI.tpfree(sendbuf); } ByteBuffer rcvbuf = ATMI.tpalloc("STRING", null, 256); try { int rcvlen; ATMI.tpgetrply(ref cd, ref rcvbuf, out rcvlen, 0); message = StringUtils.ReadStringBuffer(rcvbuf, rcvlen); Console.WriteLine("Returned string is: " + message); } finally { ATMI.tpfree(rcvbuf); } } finally { ATMI.tpterm(); } }