Python Forum
socket programming ConnectionRefusedError error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
socket programming ConnectionRefusedError error
#4
Change host to host = 'localhost' on client.
When you try to get the socket host name the socket first needs a host. If you are not connected to a server, there is no host to return a host name. The socket is just an empty socket until you connect to a server. If the client and server are on the same computer host will be 'localhost' I do't know yet what you do if they are on different computers. Also you need to do this:
from socket import socket, AF_INET, SOCK_STREAM
sock = socket(AF_INET, SOCK_STREAM)
You might also need to change host = '' on the server code.
Reply


Messages In This Thread
RE: socket programming ConnectionRefusedError error - by LavaCreeperKing - May-16-2019, 08:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  socket.error Karin 0 2,747 Nov-11-2019, 08:53 AM
Last Post: Karin
  Raw Socket Error therealherby 1 3,826 Oct-24-2019, 06:33 AM
Last Post: markfilan
  socket programming (browser) kunz 8 5,318 Dec-18-2018, 10:13 AM
Last Post: siripriya
  Python Socket programming with packets sourabhjaiswal92 1 4,137 Sep-18-2018, 06:24 AM
Last Post: martingever
  Python socket : Error receive data quanglnh1993 1 13,041 Mar-14-2018, 11:59 AM
Last Post: avorane
  socket programming user2103 2 3,609 Dec-19-2017, 11:52 AM
Last Post: user2103

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020