Connection to Localhost problem

Hello! I am learning to program in Python, so I apologize in advance for perhaps stupid question. Is it possible to do the following: 1. In one console (I mean my Pythonanywhere bash concoles) start the server, that listens port on the local machine. 2 In another console - the client, that interacts with the server. I've tried to run examples from Python documentation, items

Server console:

19:55 ~/asyncio $ python3

Serving on ('', 8886)

Client console

19:58 ~/asyncio $ python

Traceback (most recent call last):

File "", line 24, in <module> loop.run_until_complete(coro)

File "/usr/lib/python3.6/asyncio/", line 466, in run_until_complete return future.result()

File "/usr/lib/python3.6/asyncio/", line 776, in create_connection raise exceptions[0]

File "/usr/lib/python3.6/asyncio/", line 763, in create_connection yield from self.sock_connect(sock, address)

File "/usr/lib/python3.6/asyncio/", line 451, in sock_connect return (yield from fut)

File "/usr/lib/python3.6/asyncio/", line 481, in _sock_connect_cb raise OSError(err, 'Connect call failed %s' % (address,))

ConnectionRefusedError: [Errno 111] Connect call failed ('', 8886)

What i've done wrong? Thanks in advance.

HI there, we don't really support raw socket connections as a web app model (ports on console servers aren't accessible from the outside world, and we can't guarantee you'll be able to use any particular port on any given day). on top of that, different consoles tend to run on different servers!

with those two caveats, given that you're just trying to get this working for learning purposes, you might be able to get it working if, by trial and error, you get two consoles running on the same server. you can see the server you're on in the "connecting" banner at the bottom when a console first loads, or by running the "hostname" command. try opening and closing consoles until you get one on the server you want!

Thanks a lot!