mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	 9c6bd77e39
			
		
	
	
		9c6bd77e39
		
	
	
	
	
		
			
			svn+ssh://pythondev@svn.python.org/python/trunk ........ r78779 | benjamin.peterson | 2010-03-07 20:11:06 -0600 (Sun, 07 Mar 2010) | 1 line remove svn:executable from scripts without a shebang line ........
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			287 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			287 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # Receive UDP packets transmitted by a broadcasting service
 | |
| 
 | |
| MYPORT = 50000
 | |
| 
 | |
| import sys
 | |
| from socket import *
 | |
| 
 | |
| s = socket(AF_INET, SOCK_DGRAM)
 | |
| s.bind(('', MYPORT))
 | |
| 
 | |
| while 1:
 | |
|     data, wherefrom = s.recvfrom(1500, 0)
 | |
|     sys.stderr.write(repr(wherefrom) + '\n')
 | |
|     sys.stdout.write(data)
 |