[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MacTCP Help!!! -> Solution (the fix)

Here's the fix to the problem I described in my previous
message. (I decided to send the fix to the mailing list
after receiving quite a few demands for it)

  The problem I was having is due to the fact that when OPEN-TCP-STREAM
  opens a passive connection, it waits for the connection to actually
  happen. This is what you want most of the time, but for FTP it doesn't
  work (the command has to return so you can send the control sequence
  telling the server to establish connection and start the file transfert).

  The fix is trivial:

    - add another keyword argument to OPEN-TCP-STREAM: (wait-for-connection t)
    - in OPEN-TCP-STREAM, pass that argument to %TCP-PASSIVE-OPEN
    - in %TCP-PASSIVE-OPEN, pass that argument to %TCP-CONTROL
    - in %TCP-CONTROL, change the test
        (eql (setq err (#_control :async pb)) 0)
        (and (eql (setq err (#_control :async pb)) 0)
    - The extra argument in %TCP-PASSIVE-OPEN and %TCP-CONTROL should of
      course be an optional argument and the last argument so as not to
      disturb the already existing code...

With this code installed, you will be able to do stuff like
(OPEN-TCP-STREAM nil 20 :wait-for-connection nil) that should return immediatly

Further more, this code should be 100% backward compatible.

NB: If the MCL teams decides to integrate this fix into MCL 2.0 final,
    they will probably do it in a different way, so your code may
    have to be changed for MCL 2.0 final.

Guillaume Cartier
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290
E-Mail: cartier@math.uqam.ca