Closing a Connection in Conga

General APL language issues
Post Reply
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Closing a Connection in Conga

Post by paulmansour »

In Conga, you can can close a connection by supplying a 1 as the third item to DRC.Send, or by calling DRC.Close.

Are the any implications to closing one way or the other?

For example, if sending some data and closing the connection I could write:

      DRC.Send 'C1' 'some data' 1


or:

      DRC.Send 'C1' 'some data'
DRC.Close 'C1'


Are these equivalent?

Is the former just a convenience, or is the close somehow more tightly connected to the sending of the data?

Are there small differences that might show up on the other end of the wire, for example (if using Conga on the other end), getting some data in a blocklast event, or getting the data in one event, and then a separate blocklast event.
Bjørn|Dyalog
Posts: 3
Joined: Tue Sep 23, 2008 10:44 am

Re: Closing a Connection in Conga

Post by Bjørn|Dyalog »

There is a huge difference in doing

1:
      DRC.Send 'C1' 'some data' 1

and
2:
      DRC.Send 'C1' 'some data' ⋄ DRC.Close 'C1'


When you ask Conga to send a buffer, Conga will queue the buffer and return to APL immediately, the buffer get send when the socket is ready. Conga does not have an event to signal when the send is completed.
In case 1 Conga knows that when it have completed the send it should close the connection. Internally in Conga it know when the sent have completed.
In case 2. you get a race condition where you are trying to close the connection before the buffer have been sent. You have no way of knowing when the buffer have been sent and it is safe to close the connection.
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Re: Closing a Connection in Conga

Post by paulmansour »

Hi Bjørn,

Glad I asked!

On a little reflection, I should have realized that I guess.

Thanks,

Paul
Post Reply