Created
September 14, 2015 12:07
-
-
Save afq984/849c79f7201393ed4be2 to your computer and use it in GitHub Desktop.
socket problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.bind(('', 5556)) | |
s.connect(('192.168.1.1', 5556)) | |
s.send(b'first') | |
s.send(b'second') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.bind(('', 5556)) | |
s.connect(('192.168.1.1', 5556)) | |
s.send(b'first') | |
time.sleep(0.5) | |
s.send(b'second') # ConnectionRefusedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import time | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.sendto(b'first', ('192.168.1.1', 5556)) | |
time.sleep(0.5) | |
s.sendto(b'second', ('192.168.1.1', 5556)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment