Re: Help using easysockets?
Oh, I should mention. I think the object might be the sub for the OnConnectionEstablished event - I looked through the class and didn't see where I could pass the sub address to the class so I just made a sub :
ConnectionEstablished(ea As easySocket.DataReadEventArgs)
It was a wild guess and probably wrong 8(
Re: Help using easysockets?
Ok, while driving it dawned on me that the class is raising an event in exactly the same way as a forms control (which is a class). I changed my subs to something like this (cant remember the exact names)
private sub DataReceiver(sender as Object, e as System.EventArgs) handles MyConnection.DataReceived
That hasn't solved the error I get as soon as I click the connect button. It actually says object not set to an instance of an object but doesn't indicate where in the code this is happening. I'm assuming since the only thing I changed in my existing code is the myConnection parts it's something in the newly created myConnection object...
Re: Help using easysockets?
Well no surpise - it was me. I was supplying myTCPAddress.tostring but I'd cut out the myTCPAddress declaration when I removed my old tcpclient code. Odd that the debugger didn't home in on the offending assignment.
Still have one problem which I'm pretty sure isn't me (exactly). I'm trying to disconnect and using myConnection.close() (which is TCPClient.close()) but the easysocket EndARRead method throws an exception when it tries an EndRead() after the close. I'm assuming either it's not supposed to do that last endread or .Close() is the wrong way to disconnect. I can't find anything else to use to disconnect from the server though.
Any thoughts?
Re: Help using easysockets?
It shouldn't be calling EndRead after the close, but it may not matter, either. Any activity with a network connection should be performed in a Try...Catch block, because exceptional circumstances will happen. You may have already figured out a solution to this, or you may have wandered off. In any case, I have found that there are some exceptions related to network issues that are worth just swallowing without making the effort to fix them. This doesn't seem to be such a case, though, since it appears to be clearly a case of code being out of order.