Errno Error 10035
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have socket error 10054 Meta Discuss the workings and policies of this site About Us what is a socket error Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with socket error 10053 us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Socket Error 10049
like you, helping each other. Join them; it only takes a minute: Sign up Python, why it is errors 10035 (on server) and 10053 (on client) during using TCP sockets? up vote 4 down vote favorite 2 Almost 2 days I still have the same problem -client and server 'talks' to each other but I don't socket error 10054 connection reset by peer know why suddenly problem occurs during the communication. I tried really many things and unfortunately still the same problem. I'm using python 2.7.5 on Windows 7. My code: cs_common.py import socket import os import sys import errno from time import sleep HOST = 'localhost' MY_IP = socket.gethostbyname(socket.gethostname()) PORT = 50007 timeout_in_seconds = 2 def createSocket4server(host, port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(4) return s def createSocket4Client(host, port, timeout_in_seconds=3): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect( (host, port) ) print 'connected to %s port %s' % (host, port) return s sent = 0 def sendToSocket(socket_, data): # to debug global sent print sent, ') Sending:', data socket_.send(data) sent += 1 received = 0 def recvFromSocket(socket_): global received print '>>>>>>>>>>Trying to receive' data = socket_.recv(1024) print received, ') Received:', data received += 1 return data def sendDataToAllPlayers(data_to_send, connections): for c in connections: sendToSocket(c[0], data_to_send) def trySendingAsLongAsNotSent(socket_, data): while True: try: sendToSocket(socket_, data) break except socket.timeout: pass def tryReceivingAsLongAsNotReceived(socket_): while True: try: data = recvFromSocket(socket_) return data except socket.timeout: pass server.p