Jump to content
Sign in to follow this  
yucatan

how to fix this..

Recommended Posts

yucatan

hi i'm bizzy with tcpsend and tcprecieve but the problem is that i can only send one $var over the connection can somebody help me on this ?

Share this post


Link to post
Share on other sites
metalicaman8

Our sending computer's script says

; Start The TCP Services
;==============================================
TCPStartUp()

; Set Some reusable info
;--------------------------
; Set $szIPADDRESS and $nPORT to the ip and port we want to send to. We will change a PC name into an IP Address
Dim $szIPADDRESS = "ip of computer "
Dim $nPORT = 65432


; Initialize a variable to represent a connection
;==============================================
Dim $ConnectedSocket = -1


;Attempt to connect to SERVER at its IP and the port we set earlier
;=======================================================
$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)

;Set variables to send
;===================================================
Dim $var1 = hi
Dim $var2= yucatan

;Put these into one variable (notice our 2 variables are split with a |)
;======================================================
Dim $onevar = $var1 &"|"& $var2

TCPSend($ConnectedSocket,$onevar)

The TCPSend can only be used on a local network as far as I know. You may be able to use it across a vpn I don't know. This should solve the problem as you stated it though. Put 2 vars into 1 then split them back up on the receiving end.

Share this post


Link to post
Share on other sites
yucatan

Our sending computer's script says

; Start The TCP Services
;==============================================
TCPStartUp()

; Set Some reusable info
;--------------------------
; Set $szIPADDRESS and $nPORT to the ip and port we want to send to. We will change a PC name into an IP Address
Dim $szIPADDRESS = "ip of computer "
Dim $nPORT = 65432


; Initialize a variable to represent a connection
;==============================================
Dim $ConnectedSocket = -1


;Attempt to connect to SERVER at its IP and the port we set earlier
;=======================================================
$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)

;Set variables to send
;===================================================
Dim $var1 = hi
Dim $var2= yucatan

;Put these into one variable (notice our 2 variables are split with a |)
;======================================================
Dim $onevar = $var1 &"|"& $var2

TCPSend($ConnectedSocket,$onevar)

The TCPSend can only be used on a local network as far as I know. You may be able to use it across a vpn I don't know. This should solve the problem as you stated it though. Put 2 vars into 1 then split them back up on the receiving end.

hmm thx alot but what do you mean only about netnork i think its over the internet ofc...?

p.s. do i dont need to close the connection when he is done ?

pp.s. why u use

dim $var = 1

and not

$var = 1

??

Edited by yucatan

Share this post


Link to post
Share on other sites
metalicaman8

hmm thx alot but what do you mean only about netnork i think its over the internet ofc...?

Please explain the question better.

If I understand the question then I meant that TCPSend can only be used to send variables over a local network such as a lan or wireless network.

p.s. do i dont need to close the connection when he is done ?

yes you do.

TCPCloseSocket( $ConnectedSocket )
TCPShutDown()

pp.s. why u use

dim $var = 1

and not

$var = 1

I am used to stricter programming languages that require you to declare variables before they can be set. Simply habit.

Share this post


Link to post
Share on other sites
yucatan

Please explain the question better.

If I understand the question then I meant that TCPSend can only be used to send variables over a local network such as a lan or wireless network.

yes you do.

TCPCloseSocket( $ConnectedSocket )
TCPShutDown()

I am used to stricter programming languages that require you to declare variables before they can be set. Simply habit.

what do you mean with lan/wireless can i not use it to on the internet....? that not good....

i think i can be used over internet...

Share this post


Link to post
Share on other sites
yucatan

what do you mean with lan/wireless can i not use it to on the internet....? that not good....

i think i can be used over internet...

p.s. how i can detect if a $var is changed

sample if the $var changed the value in the var.. then do.....

Share this post


Link to post
Share on other sites
metalicaman8

p.s. how i can detect if a $var is changed

sample if the $var changed the value in the var.. then do.....

$var1old = $var1
while 1
If $var1 <> $var1old
Then
;Some code to execute whenvariable changes
$var1old = $var1
;that resets the if the variable changes script to the new variable
wend

I know there is a way to use it over the internet but I do not know how. This may be able to help youhttp://www.autoitscript.com/forum/index.ph...st&p=521067

Share this post


Link to post
Share on other sites
yucatan

$var1old = $var1
while 1
If $var1 <> $var1old
Then
;Some code to execute whenvariable changes
$var1old = $var1
;that resets the if the variable changes script to the new variable
wend

I know there is a way to use it over the internet but I do not know how. This may be able to help youhttp://www.autoitscript.com/forum/index.ph...st&p=521067

soz i dont understand the code but when i redefine the $var outside the while/wend does it works then ?

Share this post


Link to post
Share on other sites
metalicaman8

essentially that piece of code takes an already set $var1. It puts the value of $var1 into $var1old. It then loops and constantly checks whether the value of $var1 = the value of $var1old. When $var1 changes then $var1 will not = $var1old and it will display the new value and set it back up to check more by setting $var1old to $var1 again and repeating. This will never work because there would be no way to change either variable since they are both in a loop but it is just an example.

Share this post


Link to post
Share on other sites
ChrisL

The TCPSend can only be used on a local network as far as I know.

Sorry but that is incorrect, I have used it over the internet, if you have the correct IP address and port forwarding if behind a router there is no reason it wouldn't work over the internet

Share this post


Link to post
Share on other sites
yucatan

hi i wanne make a msgbox with chaning text b.v.

downloading...

after a couple of sec downloading complete.

and then installing...

after a couple of sec show installing complete how i can do this?

Share this post


Link to post
Share on other sites
yucatan

hi i wanne make a msgbox with chaning text b.v.

downloading...

after a couple of sec downloading complete.

and then installing...

after a couple of sec show installing complete how i can do this?

hi when i run it i get this error.

$value = StringSplit($recv, "|")

$days[1]

$days[2]

D:\Documents and Settings\Yucatan\Bureaublad\yctn anti cheat\stream-server.au3 (21) : ==> Subscript used with non-Array variable.:

Dim $guid = $recv[1]

Dim $guid = $recv^ ERROR

Edited by yucatan

Share this post


Link to post
Share on other sites
metalicaman8

hi when i run it i get this error.

D:\Documents and Settings\Yucatan\Bureaublad\yctn anti cheat\stream-server.au3 (21) : ==> Subscript used with non-Array variable.:

Dim $guid = $recv[1]

Dim $guid = $recv^ ERROR

did you use stringsplit($guid,"|") before the line the error is on? If you didn't you can't use [1] yet

Share this post


Link to post
Share on other sites
yucatan

did you use stringsplit($guid,"|") before the line the error is on? If you didn't you can't use [1] yet

jep i did so i dont understand why i get the error.. shall i post the code ?

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.