
from simple.server import SimpleServer


__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"


def handle_message(sockets=None):
    """
    Handle a simple UDP client.
    """
    if sockets is not None:
        (readable, writable, errors) = sockets
        try:
            while True:
                (data, address) = readable.recvfrom(1024)
                print('Received data: %s from %s' % (data, address))
                if data:
                    print('Sending a custom ACK to the client %s \
                          '.format(address))
                    writable.sendto("Received ;)\n", address)
                else:
                    print('Received empty data')
                    break
        finally:
            SS.close_connection()


SS = SimpleServer(connection_oriented=False)
SS.register_handler(handle_message)
SS.bind_and_listeen("localhost", 8888)


from simple.server import SimpleServer


__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"


def handle_message(sockets=None):
    """
    Handle a simple UDP client.
    """
    if sockets is not None:
        (readable, writable, errors) = sockets
        try:
            while True:
                (data, address) = readable.recvfrom(1024)
                print('Received data: %s from %s' % (data, address))
                if data:
                    print('Sending a custom ACK to the client %s'
                          % (address.__str__()))
                    writable.sendto("Received ;)\n", address)
                else:
                    print('Received empty data')
                    break
        finally:
            SS.close_connection()


SS = SimpleServer(connection_oriented=False)
SS.register_handler(handle_message)
SS.bind_and_listeen("localhost", 8888)

Fix python 2.4 connectionless service
Fix python 2.4 connectionless service

  
  from simple.server import SimpleServer
  
  
  __author__ = "Facundo Victor"
  __license__ = "MIT"
  __email__ = "facundovt@gmail.com"
  
  
  def handle_message(sockets=None):
      """
      Handle a simple UDP client.
      """
      if sockets is not None:
          (readable, writable, errors) = sockets
          try:
              while True:
                  (data, address) = readable.recvfrom(1024)
                  print('Received data: %s from %s' % (data, address))
                  if data:
-                     print('Sending a custom ACK to the client %s \
+                     print('Sending a custom ACK to the client %s'
-                           '.format(address))
+                           % (address.__str__()))
                      writable.sendto("Received ;)\n", address)
                  else:
                      print('Received empty data')
                      break
          finally:
              SS.close_connection()
  
  
  SS = SimpleServer(connection_oriented=False)
  SS.register_handler(handle_message)
  SS.bind_and_listeen("localhost", 8888)
  
Fix python 2.4 connectionless service
## Code Before:

from simple.server import SimpleServer


__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"


def handle_message(sockets=None):
    """
    Handle a simple UDP client.
    """
    if sockets is not None:
        (readable, writable, errors) = sockets
        try:
            while True:
                (data, address) = readable.recvfrom(1024)
                print('Received data: %s from %s' % (data, address))
                if data:
                    print('Sending a custom ACK to the client %s \
                          '.format(address))
                    writable.sendto("Received ;)\n", address)
                else:
                    print('Received empty data')
                    break
        finally:
            SS.close_connection()


SS = SimpleServer(connection_oriented=False)
SS.register_handler(handle_message)
SS.bind_and_listeen("localhost", 8888)

## Instruction:
Fix python 2.4 connectionless service
## Code After:

from simple.server import SimpleServer


__author__ = "Facundo Victor"
__license__ = "MIT"
__email__ = "facundovt@gmail.com"


def handle_message(sockets=None):
    """
    Handle a simple UDP client.
    """
    if sockets is not None:
        (readable, writable, errors) = sockets
        try:
            while True:
                (data, address) = readable.recvfrom(1024)
                print('Received data: %s from %s' % (data, address))
                if data:
                    print('Sending a custom ACK to the client %s'
                          % (address.__str__()))
                    writable.sendto("Received ;)\n", address)
                else:
                    print('Received empty data')
                    break
        finally:
            SS.close_connection()


SS = SimpleServer(connection_oriented=False)
SS.register_handler(handle_message)
SS.bind_and_listeen("localhost", 8888)
