Alexxander Posted August 13, 2013 Posted August 13, 2013 Hi all i'am learning Autoit and trying to make a simple app that u install it on 2 PCs that is connected over the internet , and it will show every one if the other side is online or not... i'm working on TCP and i cant find a way to detect if the other side is online i tried to send a msg over TCP every one sec and if it received by the other side it say connected and if not it say offline , but i cant get it to work , is there is any other way better than this ? please give me an example cuz i'm a noob thanks in advanced
Moderators JLogan3o13 Posted August 13, 2013 Moderators Posted August 13, 2013 Please post what you have tried thus far, even if it is not working. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Alexxander Posted August 13, 2013 Author Posted August 13, 2013 Please post what you have tried thus far, even if it is not working. script one (the sender) TCPStartup() While 1 $TCPConnect = TCPConnect(@IPAddress1, 403) TCPSend ($TCPConnect, "hi") Sleep(1000) WEnd script 2 (the receiver) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Form1") $mylist = GUICtrlCreateList("", 176, 32, 121, 97) GUISetState() TCPStartup() While 1 $msg = GUIGetMsg() $TCPListen = TCPListen(@IPAddress1, 403) Do If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit $TCPAccept = TCPAccept ($TCPListen) Until $TCPAccept <> -1 Do If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit $TCPRecive = TCPRecv ($TCPAccept, 1000000) Until $TCPRecive <> "" GUICtrlSetData($mylist, "online") WEnd these scripts are not working and it is missing i hope i could fin out a way to detect if the other side is online i think my way is stupid is there is a proffesional way for doing this ?
Developers Jos Posted August 13, 2013 Developers Posted August 13, 2013 Are both scripts running on your computer since you use the @IPAddress1 in both scripts? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Alexxander Posted August 13, 2013 Author Posted August 13, 2013 Are both scripts running on your computer since you use the @IPAddress1 in both scripts? Jos yes they are working for now its ok it the ip is local i can change it later any ideas about detecting online / offline ?
bogQ Posted August 14, 2013 Posted August 14, 2013 (edited) i dont see reason why your trying to reconnect on client in every stepwhen msg is sent if other side is not responding it should return error, putting some time trigger to send msg and check later for reply or for error shud do ittry the link in my sign to see if it can help you about two way communication working with more than one client Edited August 14, 2013 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
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