eric7.Cooperation.Connection

Module implementing a class representing a peer connection.

Global Attributes

MaxBufferSize
PingInterval
PongTimeout
SeparatorToken
SeparatorToken_b
TransferTimeout

Classes

Connection Class representing a peer connection.

Functions

None


Connection

Class representing a peer connection.

Signals

editorCommand(hash, fn, message)
emitted after an editor command has arrived (string, string, string)
getParticipants()
emitted after a get participants message has arrived
newMessage(user, message)
emitted after a new message has arrived (string, string)
participants(participants)
emitted after the list of participants has arrived (list of strings of "host:port")
readyForUse()
emitted when the connection is ready for use
rejected(message)
emitted after a connection has been rejected (string)

Derived from

QTcpSocket

Class Attributes

Editor
GetParticipants
Greeting
Participants
Ping
PlainText
Pong
ProtocolEditor
ProtocolGetParticipants
ProtocolGreeting
ProtocolMessage
ProtocolParticipants
ProtocolPing
ProtocolPong
ReadingGreeting
ReadyForUse
Undefined
WaitingForGreeting

Class Methods

None

Methods

Connection Constructor
__dataLengthForCurrentDataType Private method to get the data length for the current data type.
__disconnected Private slot to handle the connection being dropped.
__hasEnoughData Private method to check, if enough data is available.
__processData Private method to process the received data.
__processReadyRead Private slot to handle the readyRead signal.
__readDataIntoBuffer Private method to read some data into the buffer.
__readProtocolHeader Private method to read the protocol header.
__sendGreetingMessage Private slot to send a greeting message.
__sendPing Private slot to send a ping message.
name Public method to get the connection name.
sendEditorCommand Public method to send an editor command.
sendGetParticipants Public method to request a list of participants.
sendMessage Public method to send a message.
sendParticipants Public method to send the list of participants.
serverPort Public method to get the server port.
setClient Public method to set the reference to the cooperation client.
setGreetingMessage Public method to set the greeting message.
timerEvent Protected method to handle timer events.

Static Methods

None

Connection (Constructor)

Connection(parent=None)

Constructor

parent (QObject)
referenec to the parent object

Connection.__dataLengthForCurrentDataType

__dataLengthForCurrentDataType()

Private method to get the data length for the current data type.

Return:
data length
Return Type:
int

Connection.__disconnected

__disconnected()

Private slot to handle the connection being dropped.

Connection.__hasEnoughData

__hasEnoughData()

Private method to check, if enough data is available.

Return:
flag indicating availability of enough data
Return Type:
bool

Connection.__processData

__processData()

Private method to process the received data.

Connection.__processReadyRead

__processReadyRead()

Private slot to handle the readyRead signal.

Connection.__readDataIntoBuffer

__readDataIntoBuffer(maxSize=MaxBufferSize)

Private method to read some data into the buffer.

maxSize (int)
maximum size of data to read
Return:
size of data read
Return Type:
int

Connection.__readProtocolHeader

__readProtocolHeader()

Private method to read the protocol header.

Return:
flag indicating a successful read
Return Type:
bool

Connection.__sendGreetingMessage

__sendGreetingMessage()

Private slot to send a greeting message.

Connection.__sendPing

__sendPing()

Private slot to send a ping message.

Connection.name

name()

Public method to get the connection name.

Return:
connection name
Return Type:
str

Connection.sendEditorCommand

sendEditorCommand(projectHash, filename, message)

Public method to send an editor command.

projectHash (str)
hash of the project
filename (str)
project relative universal file name of the sending editor
message (str)
editor command to be sent

Connection.sendGetParticipants

sendGetParticipants()

Public method to request a list of participants.

Connection.sendMessage

sendMessage(message)

Public method to send a message.

message (str)
message to be sent
Return:
flag indicating a successful send
Return Type:
bool

Connection.sendParticipants

sendParticipants(participants)

Public method to send the list of participants.

participants (list of str)
list of participants (list of "host:port" strings)

Connection.serverPort

serverPort()

Public method to get the server port.

Return:
server port
Return Type:
int

Connection.setClient

setClient(client)

Public method to set the reference to the cooperation client.

client (CooperationClient)
reference to the cooperation client

Connection.setGreetingMessage

setGreetingMessage(message, serverPort)

Public method to set the greeting message.

message (str)
greeting message
serverPort (int)
port number to include in the message

Connection.timerEvent

timerEvent(evt)

Protected method to handle timer events.

evt (QTimerEvent)
reference to the timer event
Up