Winerror 10038 Alternatives To Sys.stdin On Windows?
I was reading up on Python Networking using sockets and found the code below at the end. I have the server file which works fine and starts the server on port 9009. # chat_client.p
Solution 1:
Also, reading on similar questions I have found out that
sys.stdin
is not a socket so that could be why I'm getting this error. Is there anything I can do to fix this?
You could manage with periodical checking of input activity, e. g. by replacing your select
statement with
# Get the list sockets which are readable, time-out after 1 s
ready_to_read = select.select([s], [], [], 1)[0]
import msvcrt
if msvcrt.kbhit(): ready_to_read.append(sys.stdin)
Note that in this example approach, when one began typing in a line, incoming messages will only be displayed after the input line is finished.
Solution 2:
i am having the same problem but not when it comes to close the socket, try s.close()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
you set socket.socket(socket.AF_INET, socket.SOCK_STREAM)
= to s
it is easier to use s.close()
and should work, if you find the solution to the other problem let me know it is driving me crazy
Post a Comment for "Winerror 10038 Alternatives To Sys.stdin On Windows?"