You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importsocketHOST='localhost'# The remote hostPORT=25# The same port as used by the serveri=0whilei<100:
withsocket.socket(socket.AF_INET, socket.SOCK_STREAM) ass:
s.connect((HOST, PORT))
s.close()
i=i+1
the exception below was generated on OS X, this needs to be investigated.
2017-07-28 17:57:34,011 (asyncio) Fatal write error on socket transport
protocol: <asyncio.streams.StreamReaderProtocol object at 0x10e047ef0>
transport: <_SelectorSocketTransport fd=35 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/selector_events.py", line 702, in write
n = self._sock.send(data)
OSError: [Errno 41] Protocol wrong type for socket
2017-07-28 17:57:34,056 (asyncio) Fatal write error on socket transport
protocol: <asyncio.streams.StreamReaderProtocol object at 0x10e44f9e8>
transport: <_SelectorSocketTransport fd=31 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/selector_events.py", line 702, in write
n = self._sock.send(data)
OSError: [Errno 41] Protocol wrong type for socket
The text was updated successfully, but these errors were encountered:
Maybe it’s showing error because there is a mismatch in the protocols, like the code is written in
UDP protocol but in the selectors_event.py file (line no. 702)
n = self._sock.send(data)
we have used .send which is used in TCP protocol, instead of writing it as .send try changing it to .sendto (used in UDP protocol)
Hence the command become,
If the file is client file and the data is in encrypted form then command will become,
n = self._sock.sendto(data,((HOST,PORT)))
and if data is not in Encrypted form,
n = self._sock.sendto(data.encode(),(HOST,PORT))
Now if the file is a server file and data is in encrypted form then the command will become,
n = self._sock.sendto(data,addr) here addr is the address of the clinet
and if the data is not in Encrypted form,
n = self._sock.sendto(data.encode(),addr)
Using this code
the exception below was generated on OS X, this needs to be investigated.
The text was updated successfully, but these errors were encountered: