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

[MacPerl] Concerning listen() and shutdown()



For interests sake I hve been timkering with downloading mail by SMTP. A
small MacPerl script seems to work, and if anyone would like to play with
it, please send me an e-mail. I would value comments.

The program listens on a generic socket and accepts an incoming call on a
real socket in this manner:

        listen(FAKE, 1);
        accept(REAL, FAKE);
        [dialogue with the server on the REAL socket]
        close REAL;
        listen(FAKE, 1)
        and so on...

Firstly, it seems that while the dialogue with the server is going on,
MacPerl cannot continue to 'listen()', so there seems to be no point in
setting a 'queuesize' more than 1 for 'listen(SOCKET, QUEUESIZE)'. Is that
so? Is it possible to 'listen()' and so something else at the same time
with MacPerl or is that tantamount to a fork()?

Secondly, having entered the listen() state, how can one get out of it if,
for instance, there is no response from the server and you want to cancel
manually? I find if you 'quit' MacPerl whilst it's in the listening state
the machine freezes on relaunch. It can hardly be blamed for protesting at
such cavalier action, really.

Thirdly, if I may go on very briefly, in the case of shutdown(SOCKET, HOW),
what in the MacPerl context is HOW?

I would be v. grateful for any comments on these matters.

Alan Fry