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

Re: [MacPerl] socket communications on a Mac



>Is it possible to make an internet socket connection work on a Mac in the 
>same manner as with Unix?
>
>(entire script below)
>
>

[script deleted]


I worked with it briefly, pointing the URL to a page on a local
server. When you cmd-. and get out of the script, then look at
the error_log of the web server, the error is:
	request failed for 199.224.118.222: error reading the headers

After monkeying around, here's the scoop:

# Add this line near the top
$NWNL = "\r\n";		# Network New line (carriage-return,line-feed)

#change this line:
$http_version = "HTTP/1.0\n\n";

# to
$http_version = "HTTP/1.0$NWNL$NWNL";

And things will be happy.  Actually just simple $NWNL = "\r" or "\012";
would work as well, the daemon is expecting an ASCII newline. I add
them both, in case some abberant daemon wants them :-) \n, in MacPerl,
translates to \015, carriage return.

Tom 'Been bitten by this before' Kimpton
Mrs. Bun: Have you got anything without spam?
Waitress: Well, there's spam egg sausage and spam, that's not got
much spam in it.
Mrs. Bun: I don't want any spam!

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch