--- Yukihiro Matsumoto <matz / ruby-lang.org> wrote: > Hi, > > In message "[ruby-talk:17595] Re: low-level TCP/IP manipulations?" > on 01/07/10, Wai-Sun Chia <waisun.chia / msa.dec.com> writes: > > |What you want is ECONNREFUSED (see connect(2)) return code, which > |unfortunately is not returned in Ruby/Socket. > > It gives ECONNREFUSED etc.; the switch you've mentioned have no > default so that all non listed errors are just passed to the callee. > I should have put "default: break" explicitly though. > > matz. Thanks, all. However, I need my emulator in Ruby to be the thing that returns the error code when a client tries to connect to it. As the following message notes, I actually need to work with a TCP/IP stack implementation if I want this kind of control, which is what I was starting to suspect. --- Waidelich Burkhard <Burkhard.Waidelich / uta.at> wrote: > From: Waidelich Burkhard <Burkhard.Waidelich / uta.at> > To: "'hotfusionman / yahoo.com'" <hotfusionman / yahoo.com> > Subject: ruby > Date: Tue, 10 Jul 2001 10:42:38 +0200 > > > test cases includes the requirement "device should return a TCP/IP No > Listener errorcode". > > I'm writing an emulator for this device in Ruby and wondering whether I > > Sorry to say that, but as far as I know, you will not find this kind of > control anywhere. > > Maybe you can find the source of a TCP stack (Linux?) and modify that. good > luck... > > However: A "no listener" may come up when you try to connect to a > non-existing socket. > > But more likely you will get only ECONNREFUSED or EHOSTUNREACH than anything > else. > > btw what kind of thing are you testing? > > From my experience there are only three important things > connection established yes/no > abort (after established) > disconnect > > The errno in clear text *is* useful in an Error-Dialog at application level, > however. > > Burkhard I'm emulating a new Ethernet switch so that we can make sure our software is robust when connecting to the switch, even if the switch behaves badly (i.e., violates our new protocol that has been defined for the interaction between the two). So basically I need to create a TCP/IP listener with specific bugs introduced into it. Al ===== Albert Davidson Chou Get answers to Mac questions at http://www.mac-mgrs.org/ . __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/