receive timeout on socket

Discussion in 'Ruby' started by Michael P. Soulier, Sep 24, 2006.

  1. --DMS1jUnP4bTQsFAd
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Hello,

    How do I set a receive timeout on a UDPSocket? I'd like to timeout after 5
    seconds. I tried this

    sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, SockTimeout)

    but I got an error.

    =2E/bin/../lib/net/tftp+.rb:508:in `setsockopt': Invalid argument
    (Errno::EINVAL)
    from ./bin/../lib/net/tftp+.rb:508:in `download'
    from ./bin/tftp_client.rb:81:in `main'
    from ./bin/tftp_client.rb:98

    Mike
    --=20
    Michael P. Soulier <>
    "Any intelligent fool can make things bigger and more complex... It
    takes a touch of genius - and a lot of courage to move in the opposite
    direction." --Albert Einstein

    --DMS1jUnP4bTQsFAd
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)

    iD8DBQFFFfS+KGqCc1vIvggRAjVrAJ9gouc6j3hFAsG3dRfn1T4FlvgmKQCdHsYq
    rcTcDeNXk3KCvyd/dqlBOwk=
    =nByH
    -----END PGP SIGNATURE-----

    --DMS1jUnP4bTQsFAd--
     
    Michael P. Soulier, Sep 24, 2006
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Katie Wright
    Replies:
    2
    Views:
    2,827
    Steve Horsley
    Aug 28, 2003
  2. christofer

    Socket Receive Buffer

    christofer, Mar 7, 2004, in forum: Python
    Replies:
    1
    Views:
    432
    Stewart Midwinter
    Mar 7, 2004
  3. Replies:
    4
    Views:
    605
  4. kanchan
    Replies:
    1
    Views:
    981
    Karthik Kumar
    Nov 13, 2004
  5. p.
    Replies:
    4
    Views:
    760
    Giampaolo Rodola'
    Jan 10, 2009
  6. Laszlo Nagy
    Replies:
    1
    Views:
    7,134
    Mark Wooding
    Jan 27, 2009
  7. Steve Holden
    Replies:
    1
    Views:
    986
  8. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,605
    Brian Candler
    Oct 6, 2004
Loading...