Created
May 12, 2018 13:45
-
-
Save spiralray/6a0356abb03996b919e144df429b7649 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
from contextlib import closing | |
def main(): | |
host = '192.168.15.10' | |
port = 12345 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
with closing(sock): | |
message = 'Hello world'.encode('utf-8') | |
print(message) | |
sock.sendto(message, (host, port)) | |
return | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment