root/python/stackless/udp_client.py

リビジョン 43, 364 bytes (コミッタ: sgk, コミット時期: 1 年 前)

見た目

  • svn:executable 属性の設定値: *
Line 
1 #!/usr/bin/env python
2
3 import socket
4 import time
5
6 DST = ('127.0.0.1', 2000)
7
8 def test():
9   sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
10   i = 0
11   while True:
12     sock.sendto(str(i), DST)
13     print '%.6f sent %d' % (time.time(), i)
14     print '%.6f %r' % (time.time(), sock.recvfrom(100))
15     time.sleep(1)
16     i += 1
17
18 if __name__ == '__main__':
19   test()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。