[Pythonmac-SIG] Off-topic : /dev/tcp

Steven D. Majewski sdm7g at mac.com
Tue Mar 30 15:17:03 EST 2004


On Mar 30, 2004, at 3:03 PM, Cameron Laird wrote:

>> From pythonmac-sig-bounces at python.org Tue Mar 30 14:44:53 2004
>> 		.
>> 		.
>> 		.
>> The book "Linux shell scripting with Bash" says that you can open
>> network connections with /dev/tcp as in
>
>> exec 3<> /dev/tcp/localhost/80
>
>> The author then gives an example in shell script of how to use 
>> /dev/tcp
>> to connect to a webserver.
>
>> I just wanted to investigating this as an alternative to a Python +
>> httplib + wxWindows script which I wrote.
>> 		.
>> 		.
>> 		.
> Oh, *that*; I would have summarized that in quite different words.
>
> I'm far more often involved in moving people from *sh to Python,
> rather than the other way around.  Let's give this a try, though.
>
> Anyway, /dev/tcp isn't a "real" inode, it's just a syntax bash and
> ksh use for networking.  So, if I understand you correctly, you
> want to do a bit of socket programming under MacOS X with bash.
> Well, that's easy enough ... no, wait; is all you want to script
> downloading of a few http: documents?  I think there's an even
> easier way to achieve that.
>


Yeah. Use 'curl' !

- sdm




More information about the Pythonmac-SIG mailing list