Sign in to follow this  
Followers 0
xzaz

TCPsend doesn't work well

4 posts in this topic

#1 ·  Posted (edited)

Alright, here it goes. I searched for quite some time but could'n find the problem i got this:

#include"GUIConstants.au3"
$g_IP = "192.168.0.8"
$g_PORT = 65432
TCPStartUp()
$socket = TCPConnect( $g_IP,$g_PORT)
;----------first time--------Works
 TCPSend($socket,"data")
If $socket = -1 Then MsgBox(16,"Error!","Connection error")     ;Check als de server aanstaat
 $GUI = GUICreate("Status script",300,300)
 ;-------------------------------menu-------------------------
 $menu = GuiCtrlCreateMenu("Menu")
 $login = GUICtrlCreateMenuItem("Log in",$menu)
 GuiSetState()

While 1
 $msg = GuiGetMsg()
 
Switch $msg
 Case $login
;----------second time--------Dosn't work
 TCPSend($socket,"data")
 Case $GUI_EVENT_CLOSE
 Exit
 EndSwitch

Wend

The the first time when i send Data to the server, it works perferct. But when i place the tcpsend on the "Second time" It dosn't work. Why?

Edited by xzaz

Share this post


Link to post
Share on other sites



Alright, here it goes. I searched for quite some time but could'n find the problem i got this:

The the first time when i send Data to the server, it works perferct. But when i place the tcpsend on the "Second time" It dosn't work. Why?

Are you sure the problem is on the Client/TcpSend side? You aren't showing the Server/TcpRcv side, and it may be dropping the connection after the first message is received.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Your right (i think) about the dropping but i can see where this is my TCPRcv:

While 1
If $recv <> "" Then
            $data = StringSplit($recv,",")
            if Not @error Then 

                    If $data[1] = "login" Then
                        GuiCtrlSetData($edit,$data[2]&" has logged in" & @CRLF & GuiCtrlRead($edit))
                    Endif
                    
            Else
            GuiCtrlSetData($edit,$recv & @CRLF & GuiCtrlRead($edit))
            Endif
Wend
EndifoÝ÷ ØGbµ.®¸ ØÚºÚ"µÍÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊBÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊBÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊ

I only see one "start"

I think i'll pass this problem to tomorow

Edited by xzaz

Share this post


Link to post
Share on other sites

Your right (i think) about the dropping but i can see where this is my TCPRcv:

EndifoÝ÷ ØGbµ.®¸ ØÚºÚ"µÍÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊBÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊBÜÙ[
    ÌÍÜÛØÚÙ] ][ÝÔÝ][ÝÊ

I only see one "start"

I think i'll pass this problem to tomorow

Well, THERE'S your problem! The forum edit bug ate your code!

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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