New topic: TCPSocket.connect doesn't connect in code
<http://forums.realsoftware.com/viewtopic.php?t=46638> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message jlawrence Post subject: TCPSocket.connect doesn't connect in codePosted: Mon Jan 21, 2013 2:58 pm Joined: Thu Dec 16, 2010 1:22 pm Posts: 183 If I drag a tcpsocket to a window and call tcpsocket1.address="www.google.com" tcpsocket1.port=80 tcpsocket1.connect the connected event fires. cool. If I put in code dim mytcpsocket = new tcpsocket mytcpsocket.address="www.google.com" mytcpsocket.port=80 mytcpsocket.connect if not mytcpsocket.isconnected then msgbox "error" end guess what? Error. Not cool! (even though lasterrorcode returns 0) but if I add a handler to the above before connecting addhandler mytcpsocket.connect, addressof mytcpisconnected and then create a method Protected Sub mytcpisconnected(mytcp as TCPSocket) MsgBox "connected" End Sub It connects! Cool! So, while I did eventually solve my problem, I would like this to be a learning experience and take some knowledge away from it that I can possibly use in the future. Can someone explain why the simple in-code example doesn't work? Thanks! Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml rbforumnotifier@monkeybreadsoftware.de