



'''simple docstring'''





def 	a_					(							_lowerCAmelCase = "mytext.txt"	,_lowerCAmelCase = False	)				->				None:
  import socket

  __lowerCamelCase	:	Optional[Any]   	=			12312  # Reserve a port for your service.
  __lowerCamelCase	:	List[Any]   	=			socket.socket()  # Create a socket object
  __lowerCamelCase	:	str   	=			socket.gethostname()  # Get local machine name
  sock.bind((host, port)	)  # Bind to the port
  sock.listen(5	)  # Now wait for client connection.

  print('Server listening....'	)

  while True:
    __lowerCamelCase	,__lowerCamelCase	:	Dict   	=			sock.accept()  # Establish connection with client.
    print(F'Got connection from {addr}'	)
    __lowerCamelCase	:	Tuple   	=			conn.recv(1024	)
    print(F'Server received: {data = }'	)

    with open(_lowerCAmelCase	,'rb'	) as in_file:
      __lowerCamelCase	:	Tuple   	=			in_file.read(1024	)
      while data:
        conn.send(_lowerCAmelCase	)
        print(F'Sent {data!r}'	)
        __lowerCamelCase	:	List[Any]   	=			in_file.read(1024	)

    print('Done sending'	)
    conn.close()
    if testing:  # Allow the test to complete
      break

  sock.shutdown(1	)
  sock.close()


if __name__ == "__main__":
   send_file()











'''simple docstring'''





import math
from timeit import timeit

def 	a_					(							_lowerCAmelCase	)				->				int:
  __lowerCamelCase	:	int   	=			0
  __lowerCamelCase	:	Optional[int]   	=			abs(_lowerCAmelCase	)
  while True:
    __lowerCamelCase	:	List[str]   	=			n // 10
    digits += 1
    if n == 0:
      break
  return digits

def 	a_					(							_lowerCAmelCase	)				->				int:
  return 1 if n == 0 else math.floor(math.log(abs(_lowerCAmelCase	)	,10	) + 1	)

def 	a_					(							_lowerCAmelCase	)				->				int:
  return len(str(abs(_lowerCAmelCase	)	)	)

def 	a_					(							)				->				None:
  from collections.abc import Callable

  def benchmark_a_function(_lowerCAmelCase	,_lowerCAmelCase	) -> None:
    __lowerCamelCase	:	Any   	=			F'{func.__name__}({value})'
    __lowerCamelCase	:	int   	=			timeit(F'__main__.{call}'	,setup='import __main__'	)
    print(F'{call}: {func(_lowerCAmelCase	)} -- {timing} seconds'	)

  for value in (262144, 1125899906842624, 1267650600228229401496703205376):
    for func in (num_digits, num_digits_fast, num_digits_faster):
      benchmark_a_function(_lowerCAmelCase	,_lowerCAmelCase	)
    print()


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   benchmark()






