Apocalypse Posted May 13, 2007 Share Posted May 13, 2007 First I would like to say that I am not making a client/server chat or anything like that. All I want to do is log all raw data that comes in and out of a port of my choice. Can anyone please show me a sample script to do something like this? This is what I got so far, but it doesn't work: #NoTrayIcon #include <File.au3> TCPStartup() $MainSocket = TCPListen(@IPAddress1, 6112) If $MainSocket == -1 Then MsgBox(0, "TCP Error", "Error Listening on TCP" & @CRLF & "@error = " & @error) Exit EndIf While 1 $Socket = TCPAccept($MainSocket) If $Socket >= 0 Then $recv = '' While $recv = '' $recv = TCPRecv($Socket, 10000) If @error Then ExitLoop WEnd _FileWriteLog(@ScriptDir & "\my.log", $recv) $recv = '' EndIf WEnd Link to comment Share on other sites More sharing options...
martin Posted May 13, 2007 Share Posted May 13, 2007 First I would like to say that I am not making a client/server chat or anything like that. All I want to do is log all raw data that comes in and out of a port of my choice. Can anyone please show me a sample script to do something like this? This is what I got so far, but it doesn't work: #NoTrayIcon #include <File.au3> TCPStartup() $MainSocket = TCPListen(@IPAddress1, 6112) If $MainSocket == -1 Then MsgBox(0, "TCP Error", "Error Listening on TCP" & @CRLF & "@error = " & @error) Exit EndIf While 1 $Socket = TCPAccept($MainSocket) If $Socket >= 0 Then $recv = '' While $recv = '' $recv = TCPRecv($Socket, 10000) If @error Then ExitLoop WEnd _FileWriteLog(@ScriptDir & "\my.log", $recv) $recv = '' EndIf WEnd Looks ok to me. Are you sure something is being sent to that port? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Apocalypse Posted May 13, 2007 Author Share Posted May 13, 2007 I am running wireshark at the same time to confirm the recieved data. Wireshark shows many packets coming in and out of that port durring the same period of time. Link to comment Share on other sites More sharing options...
Sundance Posted May 17, 2007 Share Posted May 17, 2007 Hiho, i think the prog you are running won't make a tcp connect. i guess... I'am gonna search for a solution. Need a program myself which gets the traffic over a specific port. till then Sundance 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