Jump to content
Sign in to follow this  
Hest

Need help updating gui with info

Recommended Posts

Hest

I have a piece of code from a server that receives a test from a client. When I start the server and press start, everything works fine, it receives the msg and everything.

But now I'm trying to learn some more so now I want 3 labels to update alle the time and show some info and thats what I need help with. I don't know how to update those kind of things when the program is running, so can anyone help me

Here is the code

Ohh and maybe help me how to exit the program. When the server is listening, the X dosn't close it anymore.

post-33176-1215430198_thumb.jpg

; Server
#include <GUIConstants.au3>
TCPStartup()

GUICreate("Server") 
Opt("GUICoordMode",1)
$Label_1 = GUICtrlCreateLabel("Listen to IP:", 8, 16, 90, 15)
$Input_1 = GUICtrlCreateInput(@IPAddress1, 64, 16, 200, 21)
$Label_listento = GUICtrlCreateLabel("Listening on:", 8, 200, 110, 15)
$Label_ip = GUICtrlCreateLabel("*show IP here*", 120, 200, 120, 15)
$Label_msg = GUICtrlCreateLabel("Messages received:", 8, 226, 110, 15)
$Label_msgno = GUICtrlCreateLabel("*show number here*", 120, 226, 120, 15)
$Label_lastmsg = GUICtrlCreateLabel("Last message:", 8, 252, 110, 15)
$Label_lasttext = GUICtrlCreateLabel("*show text here*", 120, 252, 120, 15)
$Button_1 = GUICtrlCreateButton("Start listening", 8, 72, 81, 25, 0)
GUISetState ()



While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

    Case $msg = $Button_1
            $listento = GUICtrlRead($Input_1)
            $listen = TCPListen($listento, 2111)
        Do
                Sleep(10)
                $socket = TCPAccept($listen)
                If $socket <> -1 Then
            Do
                    Sleep(100)
                    $temp = TCPRecv($socket, 1024)
                Until $temp <> ""
            If $temp Then
                    TCPSend($socket, "Connected")
            MsgBox(0,"Success", $listento &" sent: "& $temp)
            Else
                    TCPSend($socket, "Connection failed")
                    TCPCloseSocket($socket)
                    $socket = -1
            EndIf
                EndIf
   
        Until $msg = $GUI_EVENT_CLOSE
    EndSelect
wend
Edited by Hest

Software:Model Train Calculator (Screen)Autoit3 beginner!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.