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

Re: [MacPerl] Anyone...?



"Thomas R. Kimpton" <tkimpton@maned.com> writes, replying to Strider
<Strider@clarityconnect.com>:

}>Anyone have any idea why this doesn't work? I'm at a loss, and I think I've
}>tried everything I can think of. The send() and recv() routines don't give
}>me much either... they all sort of run forever without any extra output
}>after the initial $msg.
}>
}>require "GUSI.ph";
}>use Socket;
}>
}>$serv = "mail.serv.er";
}
}insert here:
}
}$NWNL = "\r\n";		# Network New line (carriage-return,line-feed)

No, don't do this.  Do the correct thing:

$NWNL = "\015\012";

When using MacPerl, "\r\n" is, quite properly, the same as "\012\015";

One reason to use tools like IO::Socket is that you can $socket->autoflush(1);
In your code below you need to:

select((select(Seraph),$| = 1)[0]);

I believe, to get the print's unbuffered.

Even if you don't want to use libnet, at least take a look at the code that
Net::Cmd uses to make a connection, because that does work under MacPerl.
Unless you really like futzing around, it's a whole lot faster to get
something running if you borrow some code that's know to be correct or use
the tools available with the standard MacPerl distribution.

}
}>
}>socket(Seraph, PF_INET, SOCK_STREAM, 6);
}>	$sin = sockaddr_in("25",inet_aton("$serv"));
}>	$conn = connect(Seraph,$sin);
}>	die "Connection couldn't be made. $!" if ($conn != 1);
}>	$msg = <Seraph>;
}>	if ($msg !~ /^220/) {die "Host not responding correctly.";}
}>	print "$msg";
}
}change
}
}>	print Seraph "EHLO\n";
}
}to
}
}	print Seraph "EHLO$NWNL";
}
}>	$msg = <Seraph>;
}>	print "$msg\n";
}>close(Seraph);
}>
}[stuff deleted]
}
}SMTP daemons (most, all? most/all IP server daemons?) run on network
}newlines (carriage-return,line-feed), so the server is waiting for
}it, you've only sent a line-feed. I've been bit by this behaviour
}in virtually identical code :-).
}
}Tom.
}
}
}Tom 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!
}
}


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



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