Sign in to follow this  
Followers 0
Ghost21

Chat Window

3 posts in this topic

In my program i'm running the standard While Wend for the GUI looping

while 1

; Server Chat client

EXCEPT built onto the main GUI I have a Server Chat Client

But when its continually looping waiting to receive data from the client. I can't go and use the other buttons in the GUI ?

wend

Help!

Share this post


Link to post
Share on other sites



In my program i'm running the standard While Wend for the GUI looping

while 1

; Server Chat client

EXCEPT built onto the main GUI I have a Server Chat Client

But when its continually looping waiting to receive data from the client. I can't go and use the other buttons in the GUI ?

wend

Help!

Care to post your code? It would be easier to help you if you did.


AutoIt Stuff:

 

UDFs: {Grow}

Share this post


Link to post
Share on other sites

Care to post your code? It would be easier to help you if you did.

While 1

; Bunch of if statemenst here for buttons etc.

then.

If _IsPressed('0D') And GUICtrlRead($Input) <> '' Then

$Chatcommands = GUICtrlRead($Input)

Local $szIPADDRESS = @IPAddress1

Local $nPORT = 1979

TCPStartup()

If StringLeft($Chatcommands, 7) = ".server" Then

GUICtrlSetData($Edit, ".server " & $szIPADDRESS & ":" & $nPORT & @CRLF,1)

$MainSocket = TCPListen($szIPADDRESS, $nPORT)

GUICtrlSetData($Edit, "Listening to port." & @CRLF,1)

$TCPServer = "1"

GUICtrlSetData($Input, "")

ElseIf StringLeft($Chatcommands, 7) = ".client" Then

$Chatcommands = StringSplit($Chatcommands, " ")

GUICtrlSetData($Edit, ".client " & $Chatcommands[2] & ":" & $nPORT & @CRLF,1)

$MainSocket = TCPConnect($Chatcommands[2], $nPORT)

GUICtrlSetData($Edit, "Connecting to server." & @CRLF,1)

GUICtrlSetData($Input, "")

ElseIf $Chatcommands <> "" Then

GUICtrlSetData($Edit, $Chatcommands & @CRLF,1)

$Msg = $Chatcommands

_SendAll($Msg)

GUICtrlSetData($Input, "")

Else

EndIf

;GUICtrlSetData($Edit, $Chatcommands & @CRLF)

Else

EndIf

If $TCPServer = "1" Then

$ConnectedSocket = TCPAccept($MainSocket)

If $ConnectedSocket <> -1 Then

$szIP_Accepted = SocketToIP($ConnectedSocket)

GUICtrlSetData($Edit, "Client Connected:" & $szIP_Accepted & @CRLF,1)

msgbox(0,"Trying to receive data","here")

$recv = TCPRecv($ConnectedSocket, 2048)

If $recv <> "" Then

If StringLeft($recv, 5) = ".user" Then

$Clientuser = StringSplit($recv, " ")

GUICtrlSetData($Edit, "<" & $Clientuser[2] & "> " & $recv & @CRLF,1)

Else

GUICtrlSetData($Edit, "<" & $szIP_Accepted & "> " & $recv & @CRLF,1)

EndIf

Else

EndIf

Else

EndIf

Else

EndIf

WEnd

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  
Followers 0