Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

AST notification of socket disconnection? BGDRIVER QIO API

SOLVED
Go to solution

AST notification of socket disconnection? BGDRIVER QIO API

Is it possible to set up an AST notification of a socket being closed by the remote side? A READATTN AST doesn't seem to be triggered on this event.

If it isn't possible to get an AST, is there a call that would detect the close without doing a read/write?

I can see how to fix the problem by doing a read to generate the closed error, but that requires code changes to handle
a successful read at that point in the code.

I'm using the BGDRIVER QIO API from Basic.

Jonathan
4 REPLIES
Richard J Maher
Trusted Contributor
Solution

Re: AST notification of socket disconnection? BGDRIVER QIO API

Hi Johnathan,

Your readattnast should fire. What do you have as socket options? (Full_duplex_close, probe_idle, drop_idle)

An alternative to a re-write of your code to cater for a successful read in the wrong place is to ucx$c_msg_peek with a readnowait. If successful the "real" read can take place unhindered at some later stage, and if the socket is closed you'll get the status from the peek.

I too have recently done QIO Socket Programming from BASIC, and strongly suggest a change of language.

Cheers Richard Maher

Re: AST notification of socket disconnection? BGDRIVER QIO API

The TCPIP$C_FULL_DUPLEX_CLOSE option does the job,
at least in my little test program. Thanks!

I don't have any problem with using QIOs in Basic
(Although I don't use the BASIC$STARLET declaration
for SY$QIO(W); declaring every parameter as "by value"
and using loc() to pass references is more flexible.)

The HP manual on the other hand, is a bit cryptic
about the item list for socket options. I had to poke around
to find examples to learn that you set an option by
pointing the item at a 1.
(And I think it was a TCPWARE BGDRIVER example...)

Jonathan
Richard J Maher
Trusted Contributor

Re: AST notification of socket disconnection? BGDRIVER QIO API

Hi Jonathan,

You do a loc(opt_on) and have opt_on declared as an integer with a value of one.

See attached.

Cheers Richard Maher

PS. Maybe it's only me that sees the perfect sense of *compile-time* initialization of these item lists and sockets?
Richard J Maher
Trusted Contributor

Re: AST notification of socket disconnection? BGDRIVER QIO API

On the other hand if you're using Multinet's BG driver the you receive ss$_shut and ESHUTDOWN rather thatn ss$_linkdiscon and EPIPE :-(

Of course this only happens when using the io$m_nowait modifier to the io$_readvblk so how much trouble could it cause. . .Arrrrrgh

Regards Richard Maher

PS. If you feel that you may have been affected by the issues raised in this post then please contact you Process Software rep now!