Keeping Tn objects ready |
Top Previous Next |
Many times, having these objects connected and logged in into a mainframe application is the common start and ending point for making a mainframe transacion (CICS transactions are a clear example). So maintaining Tn objects ready for their reuse is a good technique for avoiding unnecessary delays.
In these cases you can acquire a Tn object just by passing the pool name without any object identifier. This way you will get a free Tn object to reuse.
VB.NET: <WebMethod> Private Sub Page_Load() Dim telnet As Tn3270 = Tn3270.FromPool("Clemson") Try If Not telnet.IsConnected() Then telnet.Host = "clemson.clemson.edu" telnet.Port = 23 telnet.Connect(10000) End If ... Finally telnet.Release() End Try End Sub
C#: [WebMethod] public void Connect() { Tn3270 telnet = Tn3270.FromPool("Clemson"); try { if (!telnet.IsConnected()) { telnet.Host = "clemson.clemson.edu"; telnet.Port = 23; telnet.Connect(10000); } ... } finally { telnet.Release(); } }
|