Invio di un messaggio con Transaction Integrator per LU0

Dopo aver inizializzato e connesso all'unità logica (LU), è possibile inviare informazioni sulla connessione LU0. Lo strumento principale esposto da Session Integrator per l'invio di informazioni LU0 è l'oggetto SessionLU0Data e il SessionLU0.Send metodo .

Oltre all'invio di informazioni, è probabile che si voglia ricevere informazioni.

Inviare un messaggio usando Transaction Integrator per LU0

  1. Raccogliere i dati nel formato usato dall'lu.

  2. Inserire i dati in un SessionLU0Data oggetto .

  3. Inviare i dati con SessionLU0.Send.

Esempio

L'esempio di codice seguente illustra come inviare dati su una sessione LU0 usando Session Integrator.

private void InsertUserId_Click(object sender, EventArgs e)  
 {  
  try  
   {  
    // Disable every button and text box.  
     DisableEverything();  
     // Enter UserName (SNA200 is what is in the script).  
     // AID = 7D - Enter.  
     byte AID = 0x7D;  
     // Cursor address.  
     byte ca1 = 0x5B;  
     byte ca2 = 0x6B;  
     // SBA  
     byte SBA = 0x11;  
     byte fa1 = 0x5B;  
     byte fa2 = 0xE5;  
     byte[] sna200 = HostStringConverter.ConvertUnicodeToEbcdic("SNA200");  
     byte sixD = 0x6D;  
     byte [] message = new byte [8 + sna200.Length ];  
     message[0] = AID;  
     message[1] = ca1;  
     message[2] = ca2;  
     message[3] = SBA;  
     message[4] = fa1;  
     message[5] = fa2;  
     Array.Copy(sna200, 0, message, 6, sna200.Length);  
     message[6 + sna200.Length] = sixD;  
     message[7 + sna200.Length] = sixD;  
     // Send the data.  
     SessionLU0Data data = new SessionLU0Data();     data.Data = message;  
     // Trace out the data to send.  
     TraceData(true, message, 0);  
     _session.Send(data);  
     // Allow entering director.  
     EnableEnterDirector();  
     }  
    catch (Exception ex)  
    {  
     MessageBox.Show(ex.Message);  
    }  
   }  

La maggior parte di questo esempio di codice riguarda la formattazione dei dati in modo che l'lu possa interpretare correttamente le informazioni; la chiamata a SessionLU0.Send è relativamente semplice. Per altre informazioni sull'esempio di codice, vedere Esempio di codice di Session Integrator per LU0.

Vedere anche

Ricezione di un messaggio con Transaction Integrator per LU0
Session Integrator per LU0
Esempio di codice di Session Integrator per LU0
Interfaccia IcomLU0