Keyboard firmwares for Atmel AVR and Cortex-M
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

udpecho_server.py 1019B

1234567891011121314151617181920212223242526272829
  1. """
  2. mbed SDK
  3. Copyright (c) 2011-2013 ARM Limited
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. """
  14. from SocketServer import BaseRequestHandler, UDPServer
  15. from private_settings import SERVER_ADDRESS
  16. class UDP_EchoHandler(BaseRequestHandler):
  17. def handle(self):
  18. data, socket = self.request
  19. print "client:", self.client_address
  20. print "data:", data
  21. socket.sendto(data, self.client_address)
  22. server = UDPServer((SERVER_ADDRESS, 7195), UDP_EchoHandler)
  23. print "listening for connections"
  24. server.serve_forever()