Hello Chris,

On Mon, Dec 21, 2009 at 04:49:56PM -0800, Chris wrote:
> I have a client that needs to constantly send data to Django-based
> backend. The client code follows the pattern:
> 
> ...
> s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
> s.connect( ( '10.20.30.40',  8080 ) )
> while True :
>     data = s.recv( 2048 )
>     print data
> 
>     s.send( r'something' )
> ...
> 
> Could you advice on possible approaches to come up with a Django
> implementation of a backend that can work with such client, please?

I'm not aware of a way of doing exactly that. There is HTTP Connection:
keep-alive with which you could theoretically read data, but I don't see
how you would implement sending (I assume, the server is supposed to do
something with r'something'?).

If you can modify the client, your pattern seems to perfectly fit the
HTTP request - response model. So you would connect to the server, send
a request, then read the data and close the connection, all in the loop.

That said, if your client is supposed to process and respond to the data
received, I would call it "server" and rather make requests from
10.20.30.40 to it.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to