Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   SocketServer: replace network by hard drive (http://www.velocityreviews.com/forums/t734034-socketserver-replace-network-by-hard-drive.html)

antoine 09-24-2010 07:53 AM

SocketServer: replace network by hard drive
 
Hello,

I would like to create a python server for which the requests are
passed by files on the hard drive instead of a network.
I am currently looking at the SocketServer python module, hoping for
an easy modification.

Is it doable at all?
If yes, how should it be done?

Thanks,
Antoine.

Dennis Lee Bieber 09-24-2010 04:39 PM

Re: SocketServer: replace network by hard drive
 
On Fri, 24 Sep 2010 00:53:22 -0700 (PDT), antoine <boolegue@gmail.com>
declaimed the following in gmane.comp.python.general:

> I would like to create a python server for which the requests are
> passed by files on the hard drive instead of a network.
> I am currently looking at the SocketServer python module, hoping for
> an easy modification.
>
> Is it doable at all?
> If yes, how should it be done?


Uhm... First question: how will the server know a client is
"connecting"? Are you monitoring some known directory for the appearance
of a new file (created, in theory, by the client)...

And what will are "request" consist of -- an identifier for the
client process (including perhaps the name of a file to be used for
reply)... Oh, and how do you maintain state if the "connection" requires
multiple request/reply; heck, how do you ensure the file has a complete
request/reply before trying to read it?

Might be possible if the protocol emulates HTTP -- stateless; each
operation is a complete request/reply sequence and then all knowledge is
forgotten (needing a cookie in the request file to identify any needed
prior state).

But for general replacement of network "sockets" I don't see it...
The closest would be Popen() using pipes to communicate -- and just look
at how many problems get posted on trying to do "interactive" processing
with it. Of course, for your server, you need some way to tell the
server that a client wants to connect so both ends can identify a pipe.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/


Thomas Jollans 09-24-2010 05:28 PM

Re: SocketServer: replace network by hard drive
 
On Friday 24 September 2010, it occurred to antoine to exclaim:
> Hello,
>
> I would like to create a python server for which the requests are
> passed by files on the hard drive instead of a network.
> I am currently looking at the SocketServer python module, hoping for
> an easy modification.
>
> Is it doable at all?
> If yes, how should it be done?


If you're using UNIX, and you don't actually need the stream to be passed via
the hard drive (why would you?), but for some reason want to use the file
system, look info UNIX/local sockets. But, really, I'm guessing that local TCP
sockets (our old friend 127.0.0.1/8) will work just as well for whatever
you're doing (though I may be mistaken), are portable to non-UNIX system, and
won't be any slower than UNIX domain sockets on most, if not all, systems.

John Nagle 09-24-2010 07:22 PM

Re: SocketServer: replace network by hard drive
 
On 9/24/2010 12:53 AM, antoine wrote:
> Hello,
>
> I would like to create a python server for which the requests are
> passed by files on the hard drive instead of a network.
> I am currently looking at the SocketServer python module, hoping for
> an easy modification.
>
> Is it doable at all?
> If yes, how should it be done?
>
> Thanks,
> Antoine.


Yes, it can be done. But why?

ICVERIFY, the first web-based credit card processing system,
worked that way. Remember web sites which put up messages
like "Wait up to 3 minutes for your credit card transaction to
be processed. DO NOT REFRESH THIS PAGE". That's ICverify.

The ICVERIFY concept was that the client-facing side created files
in an input directory, then waited for response files to appear.
The back end drove a farm of dial-up modems, each emulating a
1200 baud credit card terminal. Each back-end process looked
for incoming work files, marked them as in use, dialed up
the credit card processing system, did the transaction, and
wrote a response file. All the process coordination was
through files.

That was 1995 technology, before the banking system had
direct Internet connections.

John Nagle

Nobody 09-25-2010 12:37 PM

Re: SocketServer: replace network by hard drive
 
On Fri, 24 Sep 2010 19:28:45 +0200, Thomas Jollans wrote:

> If you're using UNIX, and you don't actually need the stream to be
> passed via the hard drive (why would you?), but for some reason want to
> use the file system, look info UNIX/local sockets. But, really, I'm
> guessing that local TCP sockets (our old friend 127.0.0.1/8) will work
> just as well for whatever you're doing (though I may be mistaken), are
> portable to non-UNIX system, and won't be any slower than UNIX domain
> sockets on most, if not all, systems.


The problem with using the loopback interface is that it's still
"network access", which can run into all kinds of issues with security
policies, firewalls, etc.


Thomas Jollans 09-25-2010 12:45 PM

Re: SocketServer: replace network by hard drive
 
On Saturday 25 September 2010, it occurred to Nobody to exclaim:
> On Fri, 24 Sep 2010 19:28:45 +0200, Thomas Jollans wrote:
> > If you're using UNIX, and you don't actually need the stream to be
> > passed via the hard drive (why would you?), but for some reason want to
> > use the file system, look info UNIX/local sockets. But, really, I'm
> > guessing that local TCP sockets (our old friend 127.0.0.1/8) will work
> > just as well for whatever you're doing (though I may be mistaken), are
> > portable to non-UNIX system, and won't be any slower than UNIX domain
> > sockets on most, if not all, systems.

>
> The problem with using the loopback interface is that it's still
> "network access", which can run into all kinds of issues with security
> policies, firewalls, etc.


What kind of crappy firewall blocks loopback traffic? Really?

Nobody 09-26-2010 12:12 AM

Re: SocketServer: replace network by hard drive
 
On Sat, 25 Sep 2010 14:45:29 +0200, Thomas Jollans wrote:

>> The problem with using the loopback interface is that it's still
>> "network access", which can run into all kinds of issues with security
>> policies, firewalls, etc.

>
> What kind of crappy firewall blocks loopback traffic? Really?


The sort that restricts the ability to create sockets rather than
filtering traffic. ZoneAlarm works like this.



All times are GMT. The time now is 12:11 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.