Hi all,


If I have a class SIPSocket that inherits from TCPSocket and SIPServer
that inherits from TCPServer. I'd like SIPServer.accept to return a
SIPSocket instead of a TCPSocket. Unfortunately TCPServer and TCPSocket
are binary object libs and so I have to do something like this:

class SIPServer < TCPServer
...
  def accept
    SIPSocket.create(super)
  end
...
end

where SIPSocket.create adds singleton methods to the TCPSocket returned
by super  and returns it, making it into a "pseudo" SIPSocket. It has
all the methods and data of SIPSocket after accept is called but the
object type is still a TCPSocket. I'd like to get rid of this as it
means I'd have two types of SIPSockets in my program. "True" SIPSockets
produced by SIPSocket.new and "pseduo" SIPSockets (TCPSockets in
disguise) returned by SIPServer.accept. Any ideas on how to get round
this, preferably without writing C code (my C skills are not existent at
the moment)? It would be nice to specify that TCPServer returned
SIPSocket instead, as SIPSocket already has all TCPSockets methods, but
that might be a different thread entirely.

Thanks in advance,
Farrel Lifson
-- 
|DNA Research Group             mailto:flifson / cs.uct.ac.za
|Dept. of Computer Science      http://www.cs.uct.ac.za/~flifson
|University of Cape Town        +27-21-650-3127