import socket

def receiveMessage(skt):
    '''
    Get the bytes from socket and return it as a string
    :param skt: a binded UDP socket
    :return:
    '''
    skt.settimeout(20) # timeout for receiving first packet
    message=""
    ip_address=None
    try:
        while True:
            msg,add=skt.recvfrom(1024)
            ip_address=add
            message = message + msg.decode('UTF-8')
            skt.settimeout(10)
    except socket.error as socketerror:
        print("LOG: Message Received",message,"from",ip_address)
    try:
        return message,ip_address[0]
    except:
        raise Exception("No single UDP packet is received")

def sendMessage(skt,message,address_tuple):
    '''
    :param skt: socket
    :param message: message in string
    :param address: address of the machine(master/slave/client)in the format (ip,port)
    :return:
    '''
    skt.sendto(bytes(message,encoding='UTF-8'),address_tuple)
    return

2cca36f99eb50aba07bee4fb9f5e9d8c6cec72c6
<mask token>

<mask token>


def sendMessage(skt, message, address_tuple):
    """
    :param skt: socket
    :param message: message in string
    :param address: address of the machine(master/slave/client)in the format (ip,port)
    :return:
    """
    skt.sendto(bytes(message, encoding='UTF-8'), address_tuple)
    return

<mask token>


def receiveMessage(skt):
    """
    Get the bytes from socket and return it as a string
    :param skt: a binded UDP socket
    :return:
    """
    skt.settimeout(20)
    message = ''
    ip_address = None
    try:
        while True:
            msg, add = skt.recvfrom(1024)
            ip_address = add
            message = message + msg.decode('UTF-8')
            skt.settimeout(10)
    except socket.error as socketerror:
        print('LOG: Message Received', message, 'from', ip_address)
    try:
        return message, ip_address[0]
    except:
        raise Exception('No single UDP packet is received')


def sendMessage(skt, message, address_tuple):
    """
    :param skt: socket
    :param message: message in string
    :param address: address of the machine(master/slave/client)in the format (ip,port)
    :return:
    """
    skt.sendto(bytes(message, encoding='UTF-8'), address_tuple)
    return

import socket


def receiveMessage(skt):
    """
    Get the bytes from socket and return it as a string
    :param skt: a binded UDP socket
    :return:
    """
    skt.settimeout(20)
    message = ''
    ip_address = None
    try:
        while True:
            msg, add = skt.recvfrom(1024)
            ip_address = add
            message = message + msg.decode('UTF-8')
            skt.settimeout(10)
    except socket.error as socketerror:
        print('LOG: Message Received', message, 'from', ip_address)
    try:
        return message, ip_address[0]
    except:
        raise Exception('No single UDP packet is received')


def sendMessage(skt, message, address_tuple):
    """
    :param skt: socket
    :param message: message in string
    :param address: address of the machine(master/slave/client)in the format (ip,port)
    :return:
    """
    skt.sendto(bytes(message, encoding='UTF-8'), address_tuple)
    return

import socket

def receiveMessage(skt):
    '''
    Get the bytes from socket and return it as a string
    :param skt: a binded UDP socket
    :return:
    '''
    skt.settimeout(20) # timeout for receiving first packet
    message=""
    ip_address=None
    try:
        while True:
            msg,add=skt.recvfrom(1024)
            ip_address=add
            message = message + msg.decode('UTF-8')
            skt.settimeout(10)
    except socket.error as socketerror:
        print("LOG: Message Received",message,"from",ip_address)
    try:
        return message,ip_address[0]
    except:
        raise Exception("No single UDP packet is received")

def sendMessage(skt,message,address_tuple):
    '''
    :param skt: socket
    :param message: message in string
    :param address: address of the machine(master/slave/client)in the format (ip,port)
    :return:
    '''
    skt.sendto(bytes(message,encoding='UTF-8'),address_tuple)
    return
