Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jul 18, 2018 9:21 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Send data then disconnect.
PostPosted: Thu May 26, 2011 10:50 am 
Offline
User avatar

Joined: Wed Jul 07, 2010 2:55 pm
Posts: 720
Location: University Of Calgary, Faculty Of Medicine
I have a server whose protocol requires sending a message to the client then disconnecting.
I want to be sure that the data has been transmitted prior to disconnecting.
sock.write("bye bye")
sock.close()
Perhaps the flush method is for this functionality, but not sure if there was another way.
i.e. the data may be sent.. but has it been received?

_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try Xojo.


Top
 Profile  
Reply with quote  
 Post subject: Re: Send data then disconnect.
PostPosted: Thu May 26, 2011 3:04 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
Check the BytesLeftToSend property to make sure it's zero. Then disconnect. http://docs.realsoftware.com/index.php/TCPSocket.BytesLeftToSend

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Send data then disconnect.
PostPosted: Fri Jun 03, 2011 8:25 pm 
Offline
User avatar

Joined: Wed Jul 07, 2010 2:55 pm
Posts: 720
Location: University Of Calgary, Faculty Of Medicine
So there is no way to set the linger attribute on the output buffer I guess.

_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try Xojo.


Top
 Profile  
Reply with quote  
 Post subject: Re: Send data then disconnect.
PostPosted: Sat Jun 04, 2011 8:03 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
sock.write("bye bye")
'Check if empty
if iHaveSendAll then
sock.disconnect()
sock.close()
else
'Handle error here

end if


subclass the socket and add 1 property to check for the data.
iHaveSendAll(private)

then in the SendComplete event set iHaveSendAll = true

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group