HOME/Articles/

socket example 2 this do the job again (snippet)

Article Outline

Python socket example '2 this do the job again'

Modules used in program:

  • import time
  • import socket

python 2 this do the job again

Python socket example: 2 this do the job again

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))