why do i get a bad file descriptor error?
<p>i got an error for bad file descriptor for this code for the udp server program i made</p>

<pre><code>from socket import *

s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 890))

while True:
   (c,a) = s.recvfrom(1024)
   msg = 'thanks for requesting'
   s.sendto(msg,a)
   s.close()
</code></pre>

<p>the error message i got was</p>

<pre><code>Traceback (most recent call last):
File "udpserv.py", line 7, in &lt;module&gt;
(c,a) = s.recvfrom(1024)
 File "/usr/lib/python2.7/socket.py", line 174, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
</code></pre>

<p>can anyone please tell me how i got this error and how to solve it?</p>