thanh159 Posted February 3, 2011 Share Posted February 3, 2011 (edited) I want to listen packet from another ip send to my PC on port 8888 and close which sockets try to flood my PC by send packet using WPE thanks :! Edited February 3, 2011 by thanh159 Link to comment Share on other sites More sharing options...
jvanegmond Posted February 3, 2011 Share Posted February 3, 2011 (edited) The example for TCPRecv has a full single-connection server: http://www.autoitscript.com/autoit3/docs/functions/TCPRecv.htm If you need multiple connections (you probably do), I know someone posted an example 5 years ago on the forum. I can't find it at the moment, sorry. However, if you are looking at a telnet client or HTTP server. Then both of my examples have support for multiple connections. I will tell you what I told someone else yesterday who asked for remote control in turning pumps on and off: It would be easy to set up a telnet server written in AutoIt to do what you want. In the past I have made availabele a telnet server skeleton to get you started: Here you can implement commands like: Switch $sBuffer[$x] Case "quit", "q", "exit" ; Closes the server on the remote client TCPCloseSocket($sSocket[$x]) $sSocket[$x] = "" $sBuffer[$x] = "" $iAuth[$x] = 0 Case "pumpon" ; Turn the pump on with some Autoit code here TCPSend($sSocket[$x], "Pump is turned on") Case "pumpoff" ; Turn the pump off with some Autoit code here TCPSend($sSocket[$x], "Pump is turned off") Case Else TCPSend($sSocket[$x], "Invalid command. Valid commands are: pumpon, pumpoff, quit.") EndSwitch You connect to the server via a telnet client from any operating system and most smartphones. If you think that a telnet server is not powerful enough for you, or you simply don't want to type commands then you can get started with this HTTP server: The downside of the HTTP server is that authentication is not supported in the skeleton like it is in the telnet client. There is an issue with this. You mentioned WPE. Since AutoIt is fully interpreted it will not have the same performance as the same thing written in another language that is more low-level. When you tell WPE to open 100 connections to the server, and spam parseable messages into those connections, then the server will probably not work anymore until it handles all those packets which may take a few minutes even. The telnet server has favorable performance over the HTTP server. Mainly because if you have not yet authenticated it will only check the password like a dumb robot until you send the right password. You can make it drop the connection after a wrong password and I predict that the server will stand up to WPE with reasonable performance. No warranties though. Edited February 3, 2011 by Manadar github.com/jvanegmond 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