yucatan Posted May 16, 2008 Share Posted May 16, 2008 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 ? Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 16, 2008 Share Posted May 16, 2008 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. [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 (edited) 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 May 16, 2008 by yucatan Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 16, 2008 Share Posted May 16, 2008 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 = 1I am used to stricter programming languages that require you to declare variables before they can be set. Simply habit. [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 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... Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 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 changedsample if the $var changed the value in the var.. then do..... Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 16, 2008 Share Posted May 16, 2008 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 [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 $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 ? Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 16, 2008 Share Posted May 16, 2008 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. [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
ChrisL Posted May 16, 2008 Share Posted May 16, 2008 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 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? Link to comment Share on other sites More sharing options...
yucatan Posted May 16, 2008 Author Share Posted May 16, 2008 (edited) 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 May 18, 2008 by yucatan Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 16, 2008 Share Posted May 16, 2008 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^ ERRORdid you use stringsplit($guid,"|") before the line the error is on? If you didn't you can't use [1] yet [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
yucatan Posted May 18, 2008 Author Share Posted May 18, 2008 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 ? Link to comment Share on other sites More sharing options...
metalicaman8 Posted May 19, 2008 Share Posted May 19, 2008 that would be advisable [center]Take the Magic: The Gathering 'What Color Are You?' Quiz.[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now