Jump to content
Sign in to follow this  
bigfattoby

TCP server is closing after 1 msgbox

Recommended Posts

bigfattoby

Hey guys, ive got those two scripts here.

the first is my server and the secound is the client. the problem is that after ive send 1 msg from my client my server closes. How can i avoid this?

TCPStartup()

$TCPL = TCPListen(@IPAddress1, 403)

Do
    $TCPA = TCPAccept($TCPL)
Until $TCPA <> -1

Do
    $TCPR = TCPRecv($TCPA, 1000000)
Until $TCPR <> ""

MsgBox(0, "Data recived", $TCPR)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

TCPStartup()
$TCPC = TCPConnect(@IPAddress1, 403)

Global $Form1 = GUICreate("Form1", 292, 50, 192, 124)
Global $Input1 = GUICtrlCreateInput("Input1", 16, 16, 177, 21)
Global $Button1 = GUICtrlCreateButton("Button1", 200, 16, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    If $TCPC = -3 Then Exit
    If $nMsg = -3 Then Exit
    If $nMsg = $Button1 Then button1()
WEnd

Func button1()
$Iread = GUICtrlRead($Input1)
TCPSend($TCPC, $Iread)
EndFunc

Getting hang on the basic, still much to learn.If I take high class, taking high test im getting highscore right?

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  

×