Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
#!/usr/bin/env ruby opt = [5, 0]("i,i") sock = Socket(Socket, Socket, 0) sockaddr = Socket(3232, '127.0.0.1') sock(Socket, Socket, opt) puts "sockopt = " sock(sockaddr) #this tells the server at 192.168.1.10:3232 to wait 4 seconds before responding, then send some data, then wait another 4 before sending the newline -- so we should get a timeout on our socket -- after having read some of the data sock("4\r\n") start_time = Time begin result = sock(8192) rescue Errno puts "got timeout -- current state of the code this won't get hit because recvfrom isn't looking for a newline, just reads the first bit of data sent" end time = Time - start_time puts "read: after: seconds" #timeout occured, this read returns after 4 seconds #note -- this is testing against a server running, sample code for server here: http://pastie.org/314915 |