Programming Awareness, and a GMAIL account

OK – I have been doing some VB.NET today – and it has been interesting. I am finding problems without aparent solutions everywhere, and the occasional solution without a problem. More the the first though.

From The Code Project via Google,

Note: When you compile your application, VS.NET will automatically create a file called [your application name].exe.config in your bindebug folder. The contents of the app.config will be automatically copied to this new config file when you compile the application. When you deliver the application to the end user, you have to deliver the exe and this new config file called .exe.config and NOT the app.config. Users can modify the data in .exe.config file and application will read the data from the config file, when restarted.

What I was seeing was that a file TCPServer.exe.config in the BIN directory of the application environment was being deleted every time I ran the program, but just before the program finds running. It took me about an hour to find out why. All I needed to do was create a file called app.config, and the software would do the rest. And I had forgotten to include one file. Oops.

Microsoft in their own way neglect the user interface details. They concentrate on what else you need to do behind the scenes.

Missing Events

So part one fixed itself, and now part two causes a problem. I really hate fighting languages. All I want to do is to monitor if a TCP connection has seen no data in x seconds, and kill it off with prejudice. Sounds simple. That is the problem with object oriented code, with automatic garbage collection. The simple is hard, and the hard is simple.

When the TCP connections are created, they are created in an object, and there are no referenced kept to the new object, since the application knows that it will commit suicide when it is no longer needed. Fine. I think, this is all object oriented, and we can do things programatically now.

So into the class library, I put the following code


Private WithEvents t_timer As Timer

Public Sub New(ByRef Socket As Tcp, ByRef Server As Server, ByRef frmMain As frmTCPServer)

Dim t_timer As New Timer

t_timer.Interval = 30000

t_timer.Enabled = True

End Sub

Private Sub KillOld(ByVal myObject As Object, ByVal myEventArgs As EventArgs) Handles t_timer.Tick

If d_DateTime.AddSeconds(15) < Now Then
m_Tcp.Close()

End If

t_timer.Enabled = True

End Sub

According to my view of the world, this should work. It certainly does not cause problems. Apart from one major point. It never actually calls the KillOld routine. It complained when I did not have the paramaters correct. But it does not actually get called.

GMail Account

I am now one of the chosen few… I have a GMail account. Most of the good names were already gone… Those who need to know it will get the address… The system looks cool… And very fast. Quite impressed. Now if they would only start giving out more accounts…