Alexxander Posted September 2, 2013 Share Posted September 2, 2013 (edited) hi all i had made 2 scripts the first one send a shutdown command to a second script in a another PC in another network (SENDER) the other script receives the order and shut down (RECIVER) SENDER's code #include <GUIConstantsEx.au3> GUICreate("", 300,300) $com = GUICtrlCreateCombo("", 100, 75, 70, 100, 0x0003) GUICtrlSetData($com, "Shutdown|Reboot|Logoff|Standby|Hibernate") $but = GUICtrlCreateButton("Send command", 85, 150, 100,50) GUISetState() TCPStartup() While 1 $nMsg = GUIGetMsg() if $nMsg = $GUI_EVENT_CLOSE Then Exit if $nMsg = $but Then check() WEnd Func check() $check = 0 If GUICtrlRead($com) = "" Then $check = 1 if $check = 1 then MsgBox (0, "","Fill it") if $check = 0 Then but() EndFunc func but() $TCPConnect = TCPConnect("82.137.235.81", 555) TCPSend ($TCPConnect, GUICtrlRead($com)) EndFunc reciver's code TCPStartup() $TCPListen = TCPListen(@IPAddress1, 555) Do $TCPAccept = TCPAccept ($TCPListen) Until $TCPAccept <> -1 Do $TCPRecive = TCPRecv ($TCPAccept, 1000000) Until $TCPRecive <> "" $var = 0 if $TCPRecive = "Shutdown" Then $var = 1 if $TCPRecive = "Reboot" Then $var = 2 if $TCPRecive = "Logoff" Then $var = 0 if $TCPRecive = "Standby" Then $var = 32 if $TCPRecive = "Hibernate" Then $var = 64 if $TCPRecive = 1 Then $var = $var + 4 if $TCPRecive = 4 Then $var = $var MsgBox(0,"",$var) ;Shutdown($var) it was working fine when i used @ipadresses in both scripts on the same pc but when i repalced @ipadresses1 with the public IP (every script on a pc and separate networks)it wont work any ideas what i'm missing ? thanks in advanced Edited September 2, 2013 by alexander95 Link to comment Share on other sites More sharing options...
trancexx Posted September 2, 2013 Share Posted September 2, 2013 Public IP means nothing to your receiver script until you you do what's called port forwarding. That's basically translating the adress (and/or ports) from one to another done by your router. Google a bit.After that you would probably need to adjust firewall settings to allow traffic on port 555 (your script). ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Alexxander Posted September 2, 2013 Author Share Posted September 2, 2013 @trancexx Tnx fro replay bro is there is any way i can make connection between 2 pcs wothout port frpwarding ? what will happen if i made it port 80 which is opened be default ? correct me if i'm wrong Link to comment Share on other sites More sharing options...
trancexx Posted September 2, 2013 Share Posted September 2, 2013 No problem bro. You are wrong, port 80 is not "opened" by default. You can check your ports for example here. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Alexxander Posted September 2, 2013 Author Share Posted September 2, 2013 trancexx so there is no way to establish a P2P connection without PF ? Link to comment Share on other sites More sharing options...
trancexx Posted September 2, 2013 Share Posted September 2, 2013 That depends on the several things but I would say that in 99.99% cases that's true. You need port forwarding. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Alexxander Posted September 2, 2013 Author Share Posted September 2, 2013 trancexx can u tell me the several things ? and what is the 0,01 % ? PS: i know i'm too annoying Link to comment Share on other sites More sharing options...
trancexx Posted September 2, 2013 Share Posted September 2, 2013 trancexx can u tell me the several things ?and what is the 0,01 % ?That's out of the control of the user.PS: i know i'm too annoyingActually the only annoying thing is that you link my name to my profile so when I click thinking it's useful link I end up here.Oh and "u" for "you" is also annoying and "tnx"....Ehh now that I think about it, you are right. Alexxander 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Alexxander Posted September 2, 2013 Author Share Posted September 2, 2013 trancexx anyway tnx u for helping trancexx 1 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