Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Object variable error
computeronsite

From: Calgary, AB Canada
Posts: 45
Member Since: 06/12/02
posted December 20, 2004 11:59 PM

can you tell me why this code:

Try
For Each TcpObJect In MyServer.Connections
If UserIp = TcpObJect.RemoteEndPoint.Address.ToString() Then
CC = CC + 1
End If
Next TcpObJect
Catch Ex As Exception

End Try

Causes this exception error:

"System.NullReferenceException: Object variable or With block variable not set.
  at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
  at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
  at KaiserServer.Net.MainServer.MyServer_Connection(Object sender, ConnectionEventArgs e)

My application may run fine for 3 or 4 days but
after this error occurs then my application will not function again properly until i close and reopen.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 21, 2004 7:31 AM

That's going to be hard one to troubleshoot. Try isolating it through testing to a case where you can duplicate it easily, then send us a simple test program.

computeronsite

From: Calgary, AB Canada
Posts: 45
Member Since: 06/12/02
posted December 21, 2004 1:09 PM

"Try isolating it through testing to a case where you can duplicate it easily, then send us a simple test program"

I just did!
Adding this code to the connection event and then having 100's of people connect and disconnect over a few days causes the error.

Try
For Each TcpObJect In MyServer.Connections
If UserIp = TcpObJect.RemoteEndPoint.Address.ToString() Then
CC = CC + 1
End If
Next TcpObJect
Catch Ex As Exception

End Try

From what i know about VB the error description is
Referencing an object that has not been instantiated results in this error

this is the code that causes the error
TcpObJect.RemoteEndPoint.Address.ToString

This code is read from the connection event.

I would assume it is the .tostring that is the problem. The fact that it takes 3-4 days and 100's of connections on and off tells me it is a timing issue. The RemoteEndPoint.Address is either the current connection trying to read itself or a connection in the middle of connecting or disconnecting. I would think that if your company wrote the tcp control then there should be someone there that could offer a suggestion on how to avoid this.


Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 21, 2004 1:17 PM

My only suggestion would be to use a try catch to handle the error, but you said that didn't help.

Something like this would be too hard to troubleshoot here on the forum. Please create a simple client and server that can be run in stand alone mode that demos the problem. Send the apps to support@dart.com when ready.

If you are not willing (or able) to do that, please contact David Harry (sales@dart.com) to discuss further support options.
Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX