Hi,
ich versuche ein kleines Programm für eine Telnetverbindung zu einen Server zu erstellen. Leider bekomme ich keine Verbindung. ☹
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | import QtQuick 2.4 import Ubuntu.Components 1.3 import QtWebSockets 1.0 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" // Note! applicationName needs to match the "name" field of the click manifest applicationName: "dxcluster.aax" width: units.gu(50) height: units.gu(75) footerColor: "#f11ff5" backgroundColor: "orange" id: mainview property variant ccall: "" property variant cadr: "" property variant cport: "" WebSocket { id: socket url: "dxfun.com 8000" onTextMessageReceived: { //messageBox.text = messageBox.text + "\nReceived message: " + message rxtextbox.text +=message } onStatusChanged: if (socket.status == WebSocket.Error) { //console.log("Error: " + socket.errorString) rxtextbox.text += "\n*** Error: " + socket.errorString + " ***\n" } else if (socket.status == WebSocket.Open) { rxtextbox.text += "\n***Socket Open ***\n" // socket.sendTextMessage("Hello World") } else if (socket.status == WebSocket.Closed) { rxtextbox.text += "\n*** Socket closed ***\n" } active: false } Rectangle { id: rectserver x: 4 y: 2 width: mainview.width-10 height: 35 color: "#940674" border.color: "brown" border.width: 2 radius: 4 Button { id: connectbutton y: 3 anchors.left: parent.left width: 80 height: 27 text: "Connect" anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: 110 objectName: "button" z: 1 onClicked: { if (socket.status == WebSocket.Closed) { socket.url="ws://"+cadr +":"+cport socket.active = true rxtextbox.text += "*** connected to " + ccall + " "+cadr+":"+cport+" ***\n" console.log("verbinde mit "+socket.url) } } }//button ComboBox { x: 4 y: 43 width: 100 anchors.verticalCenter: parent.verticalCenter currentIndex: 5 model: ListModel { id: cbItems ListElement { text: "EA4RCH-5"; adr: "dxfun.com" ;port: "8000" } ListElement { text: "DB0ERF-5"; adr: "193.22.4.3" ;port: "41113" } ListElement { text: "DB0HGW-6"; adr: "db0hgw.dyndns.org";port: "4111" } ListElement { text: "DB0SUE-7"; adr: "193.175.191.244" ;port: "8000" } ListElement { text: "EA4RCH-5"; adr: "dxfun.com" ;port: "8000" } } onCurrentIndexChanged:{ ccall = cbItems.get(currentIndex.text).text cadr = cbItems.get(currentIndex.text).adr cport = cbItems.get(currentIndex.text).port //rxtextbox.text += "*** connected to " + ccall + " "+cadr+":"+cport+" ***\n" } }//ComboBox } Rectangle{ id:rectinputt x: 5 width: mainview.width-10 height: 35 color: "#940674" radius: 4 anchors.top: rectserver.top anchors.topMargin: 36 border.color: "brown" border.width: 2 TextInput{ id: txtextinp width: rectserver.width-txbutton.width-25 x: rectinputt.x+10 anchors.verticalCenter: rectinputt.verticalCenter font.pixelSize: FontUtils.sizeToPixels("small") color: "#fdd382" cursorVisible : true focus: true //accepted: // styl: border.bottom: 10 } } Button { id: txbutton x: 312 anchors.left: txtextinp.right+10 width: 80 height: 27 text: "Send" tooltip: "Text senden" anchors.verticalCenter: rectinputt.verticalCenter anchors.leftMargin: 110 objectName: "button" z: 1 onClicked: { if (socket.status == WebSocket.Open) { socket.sendTextMessage(txtextinp.text) txtextinp.text="" } else { rxtextbox.text +="*** Error when sending the text:\n"+txtextinp.text+"\n Socket closed ***\n" txtextinp.text="" } } }//button Rectangle{ x: 5 id: rxrect width: mainview.width-10 height: mainview.height-rectinputt.height-rectserver.height-20 color: "#940674" anchors.bottom: mainview.bottom border.color: "#d78503" border.width: 2 radius: 4 anchors.bottomMargin: 121 anchors.top: rectinputt.bottom anchors.topMargin: 6 TextArea { id: rxtextbox width: rxrect.width-5 height: rxrect.height-5 // anchors.verticalCenter: rxrect.verticalCenter // anchors.horizontalCenter: rxrect.horizontalCenter text: qsTr("DX de EA5BB: 7016.0 AN5CRM NOW SIMPLEX 1838Z IM98\n") textColor: "#000000" readOnly: true font.pixelSize: FontUtils.sizeToPixels("x-small") }//textarea }//rxrect // } } |
flotte Grüße