i got this error while running my function.   
"socket.error: [Errno 98] Address already in use"  
how can i close the address already in use and start new connection with port in python?
Stop the program or the service which is the port which you are trying to use. Alternatively, for whatever program which you are trying to write, use a PORT number which is a sufficiently high number (> 1024 for sure) and is unused.
python socket programming error