- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- how to implement timeout with sys$qio in tcp ip pr...
Operating System - OpenVMS
1820635
Members
1777
Online
109626
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2009 10:15 AM
тАО05-20-2009 10:15 AM
how to implement timeout with sys$qio in tcp ip programming
I have to make tcp ip connection to server by sending xml messages as request and have to recieve xml messages as response. I have done coding using Sys$qio system calls to communicate with the server.
When i send correct xml requests, i am gettng xml response properly. But when i am sending incorrect xml requests, the sys$qiow system call is hanging indefinitely for getting response.
Please find the timer routine and system calls i have used.
void timer_routine()
{
printf("timer has fired");
exit(1);
}
status = sys$setimr(0,timeout,timer_routine,TIMER_ID,0);
status = sys$qiow(0, channel, IO$_READVBLK, iosb, 0, 0, buffer, bufLen, 0, 0, 0, 0);
sys$cantim(TIMER_ID,0);
can one help me in solving this?
When i send correct xml requests, i am gettng xml response properly. But when i am sending incorrect xml requests, the sys$qiow system call is hanging indefinitely for getting response.
Please find the timer routine and system calls i have used.
void timer_routine()
{
printf("timer has fired");
exit(1);
}
status = sys$setimr(0,timeout,timer_routine,TIMER_ID,0);
status = sys$qiow(0, channel, IO$_READVBLK, iosb, 0, 0, buffer, bufLen, 0, 0, 0, 0);
sys$cantim(TIMER_ID,0);
can one help me in solving this?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2009 01:30 PM
тАО05-20-2009 01:30 PM
Re: how to implement timeout with sys$qio in tcp ip programming
To implement a timeout you have to use SYS$QIO instead of SYS$QIOW. CAUTION: do not use event flag #0 with SYS$QIO (best to call LIB$GET_EF).
I have attached a useful routine I wrote years ago, SYNCH_WITH_TIMEOUT.C.
Use it like this:
...
short channel;
short volatile iosb[4];
float timeout=10.0;
...
status = sys$qio(1, channel, IO$_READVBLK, iosb, 0, 0, buffer, bufLen, 0, 0, 0, 0);
if (!(status&1)) return(status);
status = synch_with_timeout( 1, channel, iosb, timeout);
if (!(status&1)) return(status);
status = iosb[0];
return(status);
I have attached a useful routine I wrote years ago, SYNCH_WITH_TIMEOUT.C.
Use it like this:
...
short channel;
short volatile iosb[4];
float timeout=10.0;
...
status = sys$qio(1, channel, IO$_READVBLK, iosb, 0, 0, buffer, bufLen, 0, 0, 0, 0);
if (!(status&1)) return(status);
status = synch_with_timeout( 1, channel, iosb, timeout);
if (!(status&1)) return(status);
status = iosb[0];
return(status);
I have one, but it's personal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2009 02:32 PM
тАО05-20-2009 02:32 PM
Re: how to implement timeout with sys$qio in tcp ip programming
Ravikanth,
You're nearly there!
Your timer AST just needs to $CANCEL(channel). If it fires before the $QIOW completes, it will cancel the I/O. You then cancel the timer and can check the IOSB to see if the I/O completed. SS$_ABORT or SS$_CANCEL indicate it was timed out.
$setimr(EFN$C_ENF,timout,cancel_io,TIMER_ID)
$qiow(EFN$C_ENF,channel,IO$_READVBLK,iosb,,,buffer,bufLen)
$cantim(TIMER_ID)
cancel_io looks like
$cancel(channel)
You're nearly there!
Your timer AST just needs to $CANCEL(channel). If it fires before the $QIOW completes, it will cancel the I/O. You then cancel the timer and can check the IOSB to see if the I/O completed. SS$_ABORT or SS$_CANCEL indicate it was timed out.
$setimr(EFN$C_ENF,timout,cancel_io,TIMER_ID)
$qiow(EFN$C_ENF,channel,IO$_READVBLK,iosb,,,buffer,bufLen)
$cantim(TIMER_ID)
cancel_io looks like
$cancel(channel)
A crucible of informative mistakes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-20-2009 05:37 PM
тАО05-20-2009 05:37 PM
Re: how to implement timeout with sys$qio in tcp ip programming
Hi Ravikanth,
John G has the answer, but a slight addition maybe to use the address of channel as your timer id. That way it would be delivered as the first arg to your timer_routine that could then do a generic $cancel(inchan)
Channel "value" otoh is probably not a very unique timer-id choice :-)
Don't forget to check for ss$_abort and ss$_cancel statii.
Cheers Richard Maher
John G has the answer, but a slight addition maybe to use the address of channel as your timer id. That way it would be delivered as the first arg to your timer_routine that could then do a generic $cancel(inchan)
Channel "value" otoh is probably not a very unique timer-id choice :-)
Don't forget to check for ss$_abort and ss$_cancel statii.
Cheers Richard Maher
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP