Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

set receive timeout with sockets

176 views
Skip to first unread message

Wolfgang Schnecker

unread,
Dec 4, 2002, 1:19:56 PM12/4/02
to
Hi,

i wrote a rpg-program with socket-communication, it works fine. On 'receive
from socket' i want only wait for 10 seconds. I found the setsockopt-api,
but when i set the receive-timeout i always get an error (returncode -1).

Does somebody know why?

Thanks
Wolfgang


D TG_TimeOut S 3S 0 INZ(20)
timeout in seconds
D OptValueP S *
D OptValueLen S 10I 0 Inz
D SOL_SOCKET C CONST(-1)
SocketLayer
D SO_RCVTIMEO C CONST(50)
recv timeout

D SetSockOpt Pr 10I 0 Extproc('setsockopt')
D SocketDesc 10I 0 Value
D Opt_Level 10I 0 Value
D Opt_Name 10I 0 Value
D Opt_Value * Value
D Opt_Len 10I 0 Value

C Eval OptValueP = %addr(TG_TimeOut)
C Eval OptValueLen = %size(TG_TimeOut)
C Eval RC = SetSockOpt(SD:SOL_Socket
C :SO_RCVTIMEO:OptValueP
C :OptValueLen)


Bradley V. Stone

unread,
Dec 4, 2002, 1:43:36 PM12/4/02
to
That is "unsupported". Sorry. I wish it were to.

You have to use select() API to do timeout.

Brad

On Wed, 4 Dec 2002 19:19:56 +0100, "Wolfgang Schnecker" <s...@sws.at>
wrote:

Carsten Flensburg

unread,
Dec 4, 2002, 1:46:00 PM12/4/02
to
Hello Wolfgang,

Your prototype looks fine - so here's a good place to start if you're
troubleshooting sockets:
http://klement.dstorm.net/rpg/socktut/index.html

Best regards,
Carsten Flensburg

"Wolfgang Schnecker" <s...@sws.at> skrev i en meddelelse
news:aslh0c$sr3m2$1...@ID-56260.news.dfncis.de...

Buck

unread,
Dec 4, 2002, 1:55:20 PM12/4/02
to
> i wrote a rpg-program with socket-communication, it works fine. On
> 'receive from socket' i want only wait for 10 seconds. I found the
> setsockopt-api, but when i set the receive-timeout i always get an
> error (returncode -1).

I don't think this is supported by iSeries. The V5R2 manual mentions that
this option is not supported unless _XOPEN_SOURCE is defined to be 520 or
greater. Try a non-blocking socket.

Scott Klement has a sockets tutorial at
http://klement.dstorm.net/rpg/socktut/index.html
--buck

Martin Brieger

unread,
Dec 4, 2002, 1:55:21 PM12/4/02
to
As most of the time, Bradley is correct and I was whining over that myself
:(

"Wolfgang Schnecker" <s...@sws.at> wrote in message
news:aslh0c$sr3m2$1...@ID-56260.news.dfncis.de...

0 new messages