コード例 #1
0
ファイル: layer2.py プロジェクト: ajm-asiaa/carta-1
class TagMessageSocket:
    """
    A socket wrapper that allows sending and receiving of TagMessages.

    Parameters
    ----------
    rawSocket: socket
    """
    def __init__(self, rawSocket):
        self.varLenSocket = VarLenSocket(rawSocket)

    def send(self, tagMessage):
        """
        Send a TagMessage by converting it to a VarLenMessage.

        Parameters
        ----------
        tagMessage: TagMessage
            The message to send.
        """
        self.varLenSocket.send(tagMessage.toVarLenMessage())

    def receive(self):
        """
        Receive a TagMessage.

        Returns
        -------
        TagMessage
            A TagMessage that has been converted from a VarLenMessage.
        """
        # get the VarLenMessage
        vlm = self.varLenSocket.receive()
        # convert the VarLenMessage to TagMessage
        return TagMessage.fromVarLenMessage(vlm)
コード例 #2
0
ファイル: layer2.py プロジェクト: durga2112/CARTAvis
class TagMessageSocket:
    """
    A socket wrapper that allows sending and receiving of TagMessages.

    Parameters
    ----------
    rawSocket: socket
    """

    def __init__(self, rawSocket):
        self.varLenSocket = VarLenSocket(rawSocket)

    def send(self, tagMessage):
        """
        Send a TagMessage by converting it to a VarLenMessage.

        Parameters
        ----------
        tagMessage: TagMessage
            The message to send.
        """
        self.varLenSocket.send(tagMessage.toVarLenMessage())

    def receive(self):
        """
        Receive a TagMessage.

        Returns
        -------
        TagMessage
            A TagMessage that has been converted from a VarLenMessage.
        """
        # get the VarLenMessage
        vlm = self.varLenSocket.receive()
        # convert the VarLenMessage to TagMessage
        return TagMessage.fromVarLenMessage(vlm)
コード例 #3
0
ファイル: layer2.py プロジェクト: ajm-asiaa/carta-1
 def __init__(self, rawSocket):
     self.varLenSocket = VarLenSocket(rawSocket)
コード例 #4
0
ファイル: layer2.py プロジェクト: durga2112/CARTAvis
 def __init__(self, rawSocket):
     self.varLenSocket = VarLenSocket(rawSocket)