• Register
0 votes
810 views

Problem :

I have looked for solution for literally hours but no luck so I am asking it here.

I am trying to build the chat server using the python's socket module. But when I run the server after my client connects to it and also the server connects, I face following exception:

[WinError 10038] An operation was attempted on something that is not a socket

I have tried to build a drastically reduced server and it works where current server does not. This exception has confused me as it is popping up nearly the line for line.

6 5 3
7,540 points

1 Answer

0 votes

Solution :

Allow me to explain the couple of things to you:

·    At the server side: Generally you will create a socket, bind it, and listen for the connections.

·    At the client side: Generally you will create a socket and then you will try to connect to the server.

I think the server side is fine in your case but when it comes to the client side you need not have following line:

s.bind(("127.0.0.1",port))

You should update your code like following example:

ip = '127.0.0.1'

port = 1234

sc.connect((ip, port))

sc.send("hello".encode("utf-8"))

while True:

 sc.send(input().encode("utf-8"))

Also please make sure that all your indentations are correct and you are closing your sockets correctly as this is the reason why you are facing this error.

9 7 4
38,600 points

Related questions

0 votes
1 answer 47 views
47 views
Problem : I have my web application which is throwing the below error while running in IE: “Illegal operation attempted on a registry key that has been marked for deletion” It works really fine in my Chrome but unfortunately gives the above error in production ... information on my error. And it confuses me as why this is only occurring when trying to use the IE. Any pointers?
asked Jan 6 alecxe 7.5k points
1 vote
1 answer 58 views
58 views
Problem : I am very new to Azure. Recently I have started experiencing the error if I try to connect my database which is currently in the VM Role it is the SQL VM Role from the Azure Website. I am experiencing following issue: SqlException (0x80131904): A connection ... : 0 - The certificate chain was issued by an authority that is not trusted.)] Can someone kindly help me in fixing above error.
asked Apr 2 morrisBson 3.2k points
0 votes
1 answer 133 views
133 views
Problem : I have my website on HostGator and also the dedicated server of my own running SQL Server 2008R2. The connection string I use is the X.X.X.X,1433 which directly points to the IP address of the dedicated server. I have already made the firewall settings on ... by the HostGator tech support team that there would be no problems from their end. Is there anybody who can fix this issue for me?
asked Dec 11, 2019 alecxe 7.5k points
0 votes
1 answer 578 views
578 views
Problem : I am using windows 10. I also have Tensorflow on my box.It says "Hello Tensorflow!" to me. However it has all of below before it: 2019-12-05 18:16:01.500579: I T:\src\github\tensorflow\tensorflow\core\platform\ ... \numpy\\.libs\\libopenblas.BNVRK7633HSX7YVO2TADGR4A5KEKXJAW.gfortran-win_amd64.dll' Consider using the--useroption or check the permissions. Any solution on this issue?
asked Dec 7, 2019 alecxe 7.5k points
0 votes
2 answers 47 views
47 views
Problem : I am new to Windows 8 OS. I am facing the error while trying to install the IIS manager from the "Turn on off windows features" on my windows 8 machine. I have already installed all the updates on my machine and also rebooted my machine and after ... install the IIS manager. The error is as follows "The function attempted to use a name that is reserved for use by another transaction".
asked Feb 17 mphil 2.3k points