Python string server address already in usePython for Security Professionals Course

Begin Learning Cyber Security for FREE Now!

Already a Member Login Here

Home Forums Courses Python for Security Professionals Course Python string server address already in use

This topic contains 0 replies, has 1 voice, and was last updated by  jefquery 1 year, 6 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #152823


    If you have been getting the error:
    socket.error: [Errno 48] Address already in use

    This is a bug. Move the socket creation and binding out of the loop in the StringServer.

    Like this:

    import socket
    def main():
        HOST  = ''
        PORT  = 50001    
        s = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
        s.bind((HOST , PORT))
        message_list = ['alpha' , 'bravo' , 'charlie' , 'delta']
        for i in message_list:
            conn, addr = s.accept()

    Hope that helps

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Our Revolution

We believe Cyber Security training should accessible for everyone, everywhere. Everyone deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is the world's largest community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge


We recommend always using caution when following any link

Are you sure you want to continue?