Cooperation/Connection.py

changeset 6484
8bed668f2a85
parent 6483
1c0bfbf78353
child 6645
ad476851d7e0
diff -r 1c0bfbf78353 -r 8bed668f2a85 Cooperation/Connection.py
--- a/Cooperation/Connection.py	Wed Aug 29 19:05:55 2018 +0200
+++ b/Cooperation/Connection.py	Thu Aug 30 18:40:35 2018 +0200
@@ -263,8 +263,8 @@
             self.abort()
             return
         
-        self.write("{0}{1}1{1}p".format(
-            Connection.ProtocolPing, SeparatorToken))
+        self.write(QByteArray("{0}{1}1{1}p".format(
+            Connection.ProtocolPing, SeparatorToken).encode("utf-8")))
     
     def __sendGreetingMessage(self):
         """
@@ -390,8 +390,8 @@
             self.newMessage.emit(
                 self.__username, str(self.__buffer, encoding="utf-8"))
         elif self.__currentDataType == Connection.Ping:
-            self.write("{0}{1}1{1}p".format(
-                Connection.ProtocolPong, SeparatorToken))
+            self.write(QByteArray("{0}{1}1{1}p".format(
+                Connection.ProtocolPong, SeparatorToken).encode("utf-8")))
         elif self.__currentDataType == Connection.Pong:
             self.__pongTime.restart()
         elif self.__currentDataType == Connection.GetParticipants:
@@ -416,10 +416,11 @@
         """
         Public method to request a list of participants.
         """
-        self.write(
+        self.write(QByteArray(
             "{0}{1}1{1}l".format(
-                Connection.ProtocolGetParticipants, SeparatorToken)
-        )
+                Connection.ProtocolGetParticipants, SeparatorToken
+            ).encode("utf-8")
+        ))
     
     def sendParticipants(self, participants):
         """

eric ide

mercurial