d0n Posted April 1, 2010 Share Posted April 1, 2010 For my script i was able to use TCPConnect and then TCPSend something to the server and its working . $socket = TCPConnect($ip, $port) However I am trying to find a way to listen to an existing socket, but TCPListen doesn't work for some reason. $socket = TCPListen($ip, $port, 5000) Both of them are using the same IP and port but TCPListen is returning a -1 error please tell me what i am doing wrong Link to comment Share on other sites More sharing options...
BrettF Posted April 1, 2010 Share Posted April 1, 2010 Well nothing should be wrong as we can't see what is wrong because there is no code for us to prove that something is wrong. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
d0n Posted April 2, 2010 Author Share Posted April 2, 2010 (edited) Hi Code that works if i start the client with autoit, i can receive the packets back TCPStartup() $socket = TCPConnect($ip, $port) ConsoleWrite("SOCKET: "&$socket&@LF) If $socket = -1 Then Exit While 1 $recv = TCPRecv ($socket, 5000) If $recv <> "" Then ConsoleWrite($recv&@CRLF) EndIf WEnd TCPShutdown() Code that doesn't work if the client is already started and talking to the server, can't get a socket TCPStartup() $socket = TCPListen($ip, $port, 100) ConsoleWrite("SOCKET: "&$socket&@LF) If $socket = -1 Then Exit While 1 $recv = TCPRecv ($socket, 5000) If $recv <> "" Then ConsoleWrite($recv&@CRLF) EndIf WEnd TCPShutdown() Edited April 2, 2010 by d0n Link to comment Share on other sites More sharing options...
d0n Posted April 3, 2010 Author Share Posted April 3, 2010 bump anyone help? Link to comment Share on other sites More sharing options...
trancexx Posted April 3, 2010 Share Posted April 3, 2010 Just read the freaking help file TCPRecv() page. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
storme Posted April 3, 2010 Share Posted April 3, 2010 For my script i was able to use TCPConnect and then TCPSend something to the server and its working .$socket = TCPConnect($ip, $port)However I am trying to find a way to listen to an existing socket, but TCPListen doesn't work for some reason.$socket = TCPListen($ip, $port, 5000)Both of them are using the same IP and port but TCPListen is returning a -1 errorplease tell me what i am doing wrongHave you tried Kips' Event Driven UDP http://www.autoitscript.com/forum/index.php?showtopic=74325 it makes life a lot easier with TCP. Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
d0n Posted April 3, 2010 Author Share Posted April 3, 2010 (edited) Just read the freaking help file TCPRecv() page.Its not that i can't recv, I can't even get a socket to the connectionAnd the I am not hosting the server, just trying to read some packets sent between THEIR server, and MY client (i think kip's UDF only works with my server/ my client, correct me if i am wrong here, might of missed something in there) Edited April 3, 2010 by d0n Link to comment Share on other sites More sharing options...
MiserableLife Posted April 4, 2010 Share Posted April 4, 2010 (edited) =,= """" You can't just "read some packets" between THAT server and YOUR client directly with autoit. And each port could only assign to 1 program. what is it you are trying to do?? Edited April 4, 2010 by MiserableLife Link to comment Share on other sites More sharing options...
storme Posted April 4, 2010 Share Posted April 4, 2010 (i think kip's UDF only works with my server/ my client, correct me if i am wrong here, might of missed something in there)No you are correct. I thought from your first message it was a client-server system you were setting up.Maybe you should add a bit of detail so everyone is on the same page? Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
BrettF Posted April 4, 2010 Share Posted April 4, 2010 He's trying to create a packet sniffer? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
d0n Posted April 4, 2010 Author Share Posted April 4, 2010 (edited) yes i guess you can call it a packet sniffer, is this possible with autoit? EDIT: Got it working with WinPcap, thank you! Edited April 4, 2010 by d0n 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