2011|08|
2013|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|05|06|07|08|09|10|11|12|
2016|01|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|

2019-02-03 udp-client-loop.py [長年日記]

#coding: UTF-8
 
import socket
from time import sleep
 
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# client.bind(("127.0.0.1",2000))
 
# client.sendto(b"12345",("127.0.0.1",2000))
 
for i in range (10):
    sleep(1)
 
    lat_train1 = 35.898216 - 0.005 * i
    lon_train1 = 139.910479 + 0.005 * i
 
    # client.sendto(b"train1,35.898216,139.910479\n",("127.0.0.1",2000))
 
    chr_train1 = "train1,"+ str(lat_train1) + "," + str(lon_train1) + "\n"
    print chr_train1
    client.sendto(chr_train1,("127.0.0.1",2000))
 
    sleep(1)
 
    lat_person1 = 35.848216 + 0.005 * i
    lon_person1 = 139.910479 + 0.005 * i
 
    # client.sendto(b"train1,35.898216,139.910479\n",("127.0.0.1",2000))
 
    chr_person1 = "person1,"+ str(lat_person1) + "," + str(lon_person1) + "\n"
    print chr_person1
    client.sendto(chr_person1,("127.0.0.1",2000))
syntax2html