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