New topic: 

When can I close...

<http://forums.realsoftware.com/viewtopic.php?t=30528>

       Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic         Author  
Message       JustSomeGuy           Post subject: When can I close...Posted: 
Fri Oct 16, 2009 8:59 pm                               
Joined: Fri May 11, 2007 11:35 am
Posts: 536              Assume I'm using a TCPSocket to handle my connection.
If as part of my protocol I must send a message and then disconnect, can I 
write the data and the close immediately,
or should I send the data, wait for the transmit complete event and then close 
the connection?  Would a flush after the write achieve the same thing?

Like wise can I assume after I call connect that I am connected or is this an 
asynchronous call and I am not connected until I get the connected event?     
_________________
A picture paints a thousand words.
A thought paints a thousand pictures.  
                            Top               ikkyino           Post subject: 
Re: When can I close...Posted: Sat Oct 17, 2009 2:21 am                        
Joined: Sun Nov 02, 2008 7:39 pm
Posts: 10              JustSomeGuy wrote:Assume I'm using a TCPSocket to handle 
my connection.
If as part of my protocol I must send a message and then disconnect, can I 
write the data and the close immediately,
or should I send the data, wait for the transmit complete event and then close 
the connection? Would a flush after the write achieve the same thing?
It doesn't take long to send data through the socket, but who can say?  To be 
safe use a delay/timer because it is possible the data won't get fully sent.


JustSomeGuy wrote:Like wise can I assume after I call connect that I am 
connected or is this an asynchronous call and I am not connected until I get 
the connected event?

Umm.. I'm not really that smart when it comes to this type of stuff... But 
couldn't you use something like

Code:tcpsocket.connect
if tcpsocket.isconnected then
  ~~ code
end


Actually this won't work too well because it does take a second to connect.  I 
use a timer for my app after i call connect.   
                            Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]     
-- 
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

[email protected]

Reply via email to