mladost1 Posted May 29, 2008 Posted May 29, 2008 (edited) I made a script that connects my and my room8s pc (TCP) by i have a problem - I have to restart my program(host) every time he turns his computer on and runs the client script. Is there a way i can check that he is disconnected and turn on the listening port again. (Does my TCPAccept() change to -1?) Edited May 29, 2008 by mladost1
Moderators SmOke_N Posted May 29, 2008 Moderators Posted May 29, 2008 I made a script that connects my and my room8s pc (TCP) by i have a problem - I have to restart my program(host) every time he turns his computer on and runs the server script. Is there a way i can check that he is disconnected and turn on the listening port again. (Does my TCPAccept() change to -1?)If he's the client, why is he running a server script? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
mladost1 Posted May 29, 2008 Author Posted May 29, 2008 If he's the client, why is he running a server script?Sorry about that, my mistake However the question still exist: $main=TCPConnect($server,$port) Do ;do something Until $main=-1 However the mainsocket never changes and if i do this the socket always refreshes and has no time to connect: $main=TCPConnect($server,$port) Do $main=TCPConnect($server,$port) ;do something Until $main=-1 What should I do?
sandin Posted May 29, 2008 Posted May 29, 2008 Global $ConnectedSocket, $szData Global $szIPADDRESS = @IPAddress1 ;IP address Global $nPORT = 23456 ;port TCPStartup() $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then Exit _listen() func _listen() Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 EndFunc While 1 $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then _listen() WEnd didn't tested it though ;/ Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll
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