The online racing simulator
Tool - InSimSniffer
(113 posts, started )
Version 1.1.3 works fine. Bug solved.
I set about to add some new features to this, but I was embarrassed by how poor the code was, so before I started working on it I decided to refactor the existing codebase to bring it up to a much higher standard.

There are no new features in this version, so to speak, but everything has been improved and brought up to date and many things run better. The code is also easier to follow and less-complex to understand (which is a benefit to me above all else). Other things such as security and compatibility have also been improved.

Anyway, it will have a few bugs here and there, and I still plan to refactor the actual packet sniffer quite a lot, but I decided to release it now in beta form so as to get feedback on any problems there are with the current code revision.

You can download 1.2 later in this thread. Please note that it will have bugs, but then every program has bugs, so meh.
Dear Microsoft,

Please fix the bugs in the Visual Studio forms designer.

KTHXBYE

I've uploaded a new version where the status bar actually works. Seriously every time I edit the application resources things mysteriously go missing from the form.
My LFS is not installed, it's just a copy that I have been keeping for so many years now, so it's not in registry and maybe that's why InSimSniffer doesn't detect it.

Alright, when I try to set the path manually, I get this:

Version: 1.2.0.0
Date: 09/12/2010 19:01:33
OS: Microsoft Windows NT 6.1.7600.0
Culture: pt-BR
Exception: ArgumentException
Message: The path is not of a legal form.
Source: mscorlib
Target: System.String NormalizePath(System.String, Boolean, Int32)
Stack Trace: at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength)
at System.IO.Path.GetDirectoryName(String path)
at InSimSniffer.OptionsDialog.OnLfsExeButtonClick(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Since I wanted to use it asap and I can't expect you (and you don't have to) to be here 24/7, I tried to solve it by my own workarounding that problem.

On OnLfsExeButtonClick(), I changed:
dlg.InitialDirectory = Path.GetDirectoryName(lfsExeTextBox.Text);

to

if (lfsExeTextBox.Text != "")
{
dlg.InitialDirectory = Path.GetDirectoryName(lfsExeTextBox.Text);
}

Now I can select the path manually without any problem, it even launches LFS correctly. BUT, I still can't connect to my LFS.

It says:
"Make sure LFS is running and configured to accept connections on the correct port."

I tried connecting after launching LFS by my own and setting insim to 29999, tried 127.0.0.1, tried 192.168.1.2, nothing works.

Have you got any idea to help me?

Thanks,
Lucas
Quote :Version: 1.2.0.0
Date: 10.12.2010 0:16:58
OS: Microsoft Windows NT 6.0.6002 Service Pack 2
Culture: en-US
Exception: InSimException
Message: Did not receive VER
Source: InSimSniffer.InSim
Target: InSimSniffer.InSim.Packets.IS_VER ReceiveVersion()
Stack Trace: at InSimSniffer.InSim.InSimClient.ReceiveVersion()
at InSimSniffer.InSim.InSimClient.EndInitialize(IAsyncResult asyncResult)
at InSimSniffer.MainForm.ConnectCallback(IAsyncResult r)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.Socket.MultipleAddressConnectCallback(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.Socket.ConnectCallback()
at System.Net.Sockets.Socket.RegisteredWaitCallback(Object state, Boolean timedOut)
at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)
Inner Exception:

I clicked connect without changing any connection settings (password doesn't match), InSim was enabled on port 29999.
OK - I have fixed the password miss-match bug and the illegal path bug and uploaded a new version to the beta post. The illegal path bug was introduced by a change I made to make the LFS.exe browse dialog work better on Windows 7, the admin password bug was in code unchanged from the old version but had just never been reported before.

Quote from RenvoN :Now I can select the path manually without any problem, it even launches LFS correctly. BUT, I still can't connect to my LFS.

It says:
"Make sure LFS is running and configured to accept connections on the correct port."

I tried connecting after launching LFS by my own and setting insim to 29999, tried 127.0.0.1, tried 192.168.1.2, nothing works.

Have you got any idea to help me?

Thanks,
Lucas

I can't say for certain what the problem is, but that message is ConnectionRefused, which means that either LFS is not running or the host/port information your provided is incorrect.

Do you get this error with the old/stable version of InSimSniffer?
Quote from DarkTimes :I can't say for certain what the problem is, but that message is ConnectionRefused, which means that either LFS is not running or the host/port information your provided is incorrect.

Do you get this error on the old/stable version of InSimSniffer?

Just tested it and same thing happens.

I took an screenshot of my configs:



Everything seems to be set up correctly
Edit: Ignore, it turns out it was my bug.
I found the problem.

At least on the stable version, it's not passing the IP correctly. I type 192.168.1.2 (which is correct to connect to my LFS) and it's shown as 127.0.0.1 on BeginInitialise().

Since I don't know how to fix that, and I needed to know if it was the real problem, so I putted:

settings.Host = "192.168.1.2";

And it connects perfectly now, so it must be a problem with getting the IP from the field.

Hope I have helped somehow!
Quote from RenvoN :I found the problem.

At least on the stable version, it's not passing the IP correctly. I type 192.168.1.2 (which is correct to connect to my LFS) and it's shown as 127.0.0.1 on BeginInitialise().

Since I don't know how to fix that, and I needed to know if it was the real problem, so I putted:

settings.Host = "192.168.1.2";

And it connects perfectly now, so it must be a problem with getting the IP from the field.

Hope I have helped somehow!

OK I understand the bug now and I have fixed it. I have uploaded a fixed version to the beta post.

Thanks for the help, it's great to get these issues sorted, so often people don't even bother to report them.

Edit:Reporting bugs is like voting in an election. If you don't report bugs, you don't get to complain about errors.
Quote from DarkTimes :Edit:Reporting bugs is like voting in an election. If you don't report bugs, you don't get to complain about errors.

Broken, I've found your next signature quote.
Quote from Dygear :Broken, I've found your next signature quote.

I still like the current one better.
(Sorry DarkTimes)
No problems so far, except for 2 oddities that already existed:
- When launching LFS, InSimSniffer is a bit too impatient. On my (admittedly slow) system, it signals failure to connect before LFS has fully started up.
- Tab order of fields in the InSim tab of the options dialog is messed up. Or should we blame MS VS Forms Designer?
- Pining for the fjords!? (OK, after clicking that button the app has indeed ceased to be. But WTH is it for?)
OK, thanks for those reports. I just haven't checked the tab stop order for a while, so I guess it must have gotten mixed up.

I can try adding a call to Process.WaitForInputIdle() to the LFS launch code, which will cause InSimSniffer to wait until LFS has finished creating its main window and the message pump goes into an idle state. Hopefully by then the socket code should be ready for it to connect.

The exception thing was something I put in to allow me to test the unhandled exception code and I decided to leave it. It lets people see what happens when an error occurs. I don't remember where the Monty Python references came from.
Ouch. The Export function doesn't work anymore. It causes a crash as soon as I select "Export" from the menu. Here is the crash report:
Version: 1.2.0.0
Date: 12-12-2010 0:21:32
OS: Microsoft Windows NT 5.1.2600 Service Pack 3
Culture: nl-NL
Exception: InvalidOperationException
Message: Bestand InSimSniffer Export 12-12-2010 00:21 is een ongeldige bestandsnaam.
Source: System.Windows.Forms
Target: Boolean RunFileDialog(OPENFILENAME_I)
Stack Trace: bij System.Windows.Forms.SaveFileDialog.RunFileDialog(OPENFILENAME_I ofn)
bij System.Windows.Forms.FileDialog.RunDialogOld(IntPtr hWndOwner)
bij System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
bij System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
bij System.Windows.Forms.CommonDialog.ShowDialog()
bij InSimSniffer.MainForm.OnFileExportMenuItemClick(Object sender, EventArgs e)
bij System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
bij System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
bij System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
bij System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
bij System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
bij System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
bij System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
bij System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
bij System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bij System.Windows.Forms.Control.WndProc(Message& m)
bij System.Windows.Forms.ScrollableControl.WndProc(Message& m)
bij System.Windows.Forms.ToolStrip.WndProc(Message& m)
bij System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Inner Exception:

Note for non-Dutch speakers: "Bestand [...] is een ongeldige bestandsnaam" means that the file name is invalid.
Hmm quite a few errors in this beta it seems.

I had added some stuff that generates a default filename for you when you click export, and while it works on this PC, that doesn't seem to be the case for you. I think it may be an internationalization issue, as the filename in that error report is slightly different from how I intended it to look. Anyway, I've simplified all that stuff now which should get rid of it.

I was't planning on releasing a new version until I had finished the new sniffer code, but I have uploaded BETA 3 which is just BETA 2 with a few bug fixes.

In addition to confirming the export now works (hopefully), I'd also appreciate it if you could report back on whether the Launch LFS code is any better.

Thanks!
Yep, both issues fixed.
Amazing turnaround time, BTW!
I have uploaded a new version to CodePlex.

It has all new sniffer code, so again it may have one or two bugs. I also rewrote the options dialog to make it easier to use.

Please report any bugs or issues you may have.
-
(DarkTimes) DELETED by DarkTimes : Obsolete
Hate to be the bringer of bad news, but there is another crash-causing bug. When trying to send a TINY_RIP message, InSimSniffer crashes immediately after selecting the menu item, with this exception:
Version: 1.2.0.0
Date: 19-12-2010 20:37:06
OS: Microsoft Windows NT 5.1.2600 Service Pack 3
Culture: nl-NL
Exception: InvalidCastException
Message: De opgegeven conversie is ongeldig.
Source: InSimSniffer.Library
Target: System.String LookupMpr(System.Object)
Stack Trace: bij InSimSniffer.Library.SnifferService.LookupMpr(Object value)
bij InSimSniffer.Library.SnifferService.LookupInformation(String name, Object value)
bij InSimSniffer.Library.SnifferService.SniffValues(Object packet)
bij InSimSniffer.Library.SnifferService.SniffPacket(IPacket packet)
bij InSimSniffer.Library.SnifferClient.HandlePacket(Byte[] buffer)
bij InSimSniffer.Library.SnifferClient.OnTcpSocketReceiveCompleted(Object sender, ReceiveCompletedEventArgs e)
bij InSimSniffer.Library.TcpSocket.OnReceiveCompleted(ReceiveCompletedEventArgs e)
bij InSimSniffer.Library.TcpSocket.ReceiveCallback(IAsyncResult asyncResult)
bij System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bij System.Net.ContextAwareResult.CompleteCallback(Object state)
bij System.Threading.ExecutionContext.runTryCode(Object userData)
bij System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
bij System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bij System.Net.ContextAwareResult.Complete(IntPtr userToken)
bij System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bij System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
bij System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Inner Exception:

OK thanks, I had already fixed that error in my version, I just hadn't pushed the changes out to release.

I've uploaded a new version to CodePlex.

This update, with the major-refactorings, does seem to have caused a lot of bugs, sorry.
I hadn't really thought about it up until now, but the way I was figuring out the elapsed time was kinda low-tech and not very accurate. I've updated it to use a high-performance timer which gives much more accurate readings.

As ever it's on CodePlex.
-
(vforce) DELETED by vforce
-
(vforce) DELETED by vforce
Uploaded version 1.2.4 to CodePlex:

Changes
  • String encoding support for double-byte charsets (e.g. shift-jis, trad chinese etc..)
  • Can restore app from notification tray by left-clicking notify icon and balloon tooltip
  • Improvements to the way menus are shown
  • Fixed several issues with dialog boxes when main window is in always on top mode
  • Fixed bug with disconnecting from InSim while sniffer is paused
Note: The new string encoding stuff is a little experimental, but hopefully it shouldn't explode. Adding it to InSimSniffer seems as good a way as any to test it.
Uploaded 1.2.5 to CodePlex.

Changes
  • Added new text-based filter
  • Optimized string encoding code
I've replaced the old CheckedListBox filter tab with a new text-based one. The old filter tab has been removed and there is now a new TextBox at the top of the packet list that allows you type a packet name and filter the list on the fly.

I'm happy to receive feedback on the new filter, if you hate it or whatever. I think it's better overall but may need some tweaking. One issue is it might not scale well to having thousandths and thousandths of packets. I do maintain that InSimSniffer is a bad tool to use if you just want to do general logging, but the idea of having a standalone InSim event logging tool has been bought up before and perhaps it's time for someone to write one.
-
(DarkTimes) DELETED by DarkTimes
-
(DarkTimes) DELETED by DarkTimes : Obsolete
Got an issue connecting this to Z32 - gives me an error message of "the given key was not present in the directory"

Tool - InSimSniffer
(113 posts, started )
FGED GREDG RDFGDR GSFDG