#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):

 Sorry, I guess to use WikiFormatting, the braces need to be on their own
 line, trying again with code sample...
 
 {{{
 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:13>
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