Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:35:45+00:00 2026-06-07T14:35:45+00:00

Included below is the code that I am currently using: soc1 = socket.socket(socket.AF_INET,socket.SOCK_STREAM) ADDR

  • 0

Included below is the code that I am currently using:

soc1 = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
ADDR = (HOST,PORT)
soc1.connect(ADDR)
soc1.send('WILL SEND')   

The error message that I receive when running the above code is:

Traceback (most recent call last):
  File "C:\workspace\wx_python_test\chat_server.py", line 25, in <module>
    soc1.connect(ADDR)
  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 10061] 

Could anyone please explain what the issue is that I am experiencing and how I can correct it?

Full source code: http://pastie.org/4245314

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:35:47+00:00Added an answer on June 7, 2026 at 2:35 pm

    socket.error: [Errno 10061] indicates that the port you are trying to connect to is not open. You need to make sure that the port is open and something is listening for your connection to be made.

    It appears that you are trying to test a chat server. In order for the chat server to work properly you will want to make sure that it is currently listening on the specified port.

    Twisted provides a good framework if you haven’t checked it out previously.

    from twisted.internet.protocol import Factory
    from twisted.protocols.basic import LineReceiver
    from twisted.internet import reactor
    
    class Chat(LineReceiver):
    
        def __init__(self, users):
            self.users = users
            self.name = None
            self.state = "GETNAME"
    
        def connectionMade(self):
            self.sendLine("What's your name?")
    
        def connectionLost(self, reason):
            if self.users.has_key(self.name):
                del self.users[self.name]
    
        def lineReceived(self, line):
            if self.state == "GETNAME":
                self.handle_GETNAME(line)
            else:
                self.handle_CHAT(line)
    
        def handle_GETNAME(self, name):
            if self.users.has_key(name):
                self.sendLine("Name taken, please choose another.")
                return
            self.sendLine("Welcome, %s!" % (name,))
            self.name = name
            self.users[name] = self
            self.state = "CHAT"
    
        def handle_CHAT(self, message):
            message = "<%s> %s" % (self.name, message)
            for name, protocol in self.users.iteritems():
                if ':' in message:
                    self.exc(message.split(':')[0])
                if protocol != self:
                    protocol.sendLine(message)
    
        def exc(self, cmd):
            print cmd
            if cmd == 'who':
                for i in self.users:
                    print i
    
    
    class ChatFactory(Factory):
    
        def __init__(self):
            self.users = {} # maps user names to Chat instances
    
        def buildProtocol(self, addr):
            return Chat(self.users)
    
    
    reactor.listenTCP(8123, ChatFactory())
    reactor.run()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While running the code I've included below I receive the error EntityCommandExecutionException was unhandled
I am getting LNK2001 error. The code has been included below. Can someone please
Please see the code below: #include <iostream> #include <stdlib.h> #include <time.h> using namespace std;
Please see the code snippet below : #include <iostream> using namespace std; int main()
I can get the list of country names using below code, (copied from somewhere
I wonder whether someone can help me please. I'm using the code below to
I have some doubt on below code #include<stdio.h> int i=6; int main() { int
I can't figure out how to modify the below code to include a toggle
In the code below i was expecting another output! : #include <stdio.h> #include <stdlib.h>
my test code is below: main1.c: #include <stdio.h> extern struct tt ; int main()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.