On Apr 11, 2010, at 10:20 AM, vishwanath b wrote:

> thanx for the reply...peter i am new to django so i am a bit confused
> regarding implementing this...will i have to write python socket
> client code in views which would interact with server c code rite?
> 
> On Apr 11, 7:11 pm, Peter Herndon <tphern...@gmail.com> wrote:
>> On Apr 11, 2010, at 5:52 AM, vishwanath b wrote:
>> 
>>> I have developed an application in django which has to send or receive
>>> requests from/to a server.These requests have to be sent or received
>>> through sockets.how do i achieve this?
>> 
>> Python socket programming:http://docs.python.org/library/socket.html
>> 
>> An amazingly good book on the 
>> subject:http://www.complete.org/FoundationsOfPythonNetworkProgramming

Django is a web framework, that is, HTTP.  As such, it abstracts the mechanisms 
of connecting via TCP/IP sockets, so that you, the web application developer, 
do not need to deal with low-level socket programming.  However, it does so 
only for HTTP, not for any other kind of network protocol.

If you, as you said in your original email, need to connect to network sockets 
to transmit data that are *not* HTTP protocol, you will need to implement that 
functionality yourself.  Yes, it can go in a view, if that's the appropriate 
place for the code.  But at that point, you are working beyond Django's scope, 
and will need to either implement your solution using Python's socket library, 
or perhaps using a third-party library that implements a client for whatever 
network service you are using.

In short, you haven't described your problem very well.  Tell us about the 
services with which you need to communicate, and perhaps we can point you in 
the right direction.  Better yet, search Google for "python <network_service>", 
where network_service is whatever you are trying to use.  You will likely find 
that higher-level libraries exist to facilitate your work for just about every 
network protocol.  On the other hand, if you are interfacing with custom code, 
well, you'll likely have to write your own Python client library yourself, and 
then call that library from within your views.

---Peter Herndon

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

Reply via email to