#4444: broken pipe issue
------------------------------+---------------------------------------------
   Reporter:  vanderkerkoff   |                Owner:  adrian        
     Status:  reopened        |            Component:  Core framework
    Version:  SVN             |           Resolution:                
   Keywords:  broken pipe 32  |                Stage:  Unreviewed    
  Has_patch:  0               |           Needs_docs:  0             
Needs_tests:  0               |   Needs_better_patch:  0             
------------------------------+---------------------------------------------
Comment (by anonymous):

 I am getting exactly this same error. However, in my case the socket
 connection is coming from a JavaScript I'm running inside After Effects
 (the script is spawned by my Django app via AppleScript and After Effects
 defines a Socket object for its scripts). So, I don't think it's a browser
 issue. Same deal as above, the first time the view is called (in my case
 it's really just a function and not technically a "view" since it never
 sends an HttpResponse to the browser), the socket works perfectly; data is
 transmitted and received, and the sockets appear to be closed properly.
 The second time I hit this view, however, I get the same broken pipe error
 and trace in the Terminal as listed above and no socket is opened.
 
 Here is my view code:
 
 {{{def test_socket(request):
         print 'TESTING SOCKET'
 
         conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         if conn is None:
                 print 'Connection is invalid, bailing.'
                 return None
 
         conn.bind(('', 7021))
         print 'SERVER: waiting for connection.'
         conn.listen(5)
         print 'SERVER: listening.'
 
         try:
                 try:
                         newSocket, address = conn.accept()
                         print 'SERVER: connected from address', address
 
                         while True:
                                 rawData = newSocket.recv(8192)
                                 print 'SERVER: received data: "%s"' %
 rawData
 
                                 if rawData is not None:
                                         # newSocket.shutdown(1)
                                         # We got the data, get out of the
 loop
                                         break
                 finally:
                         if newSocket is not None:
                                 newSocket.sendall('DONE')
                                 newSocket.close()
                                 print 'SERVER: data receive socket
 closed.'
         finally:
                 if conn is not None:
                         conn.close()
                         print 'SERVER: main socket closed.'
 
         print 'SOCKET TEST COMPLETED'
 
         return None}}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4444#comment:12>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to