Overview
Features
Download
Documentation
Community
Add-Ons & Services

Can Net::StreamSocket::receiveBytes "hang" ?

A general discussion forum.

Can Net::StreamSocket::receiveBytes "hang" ?

Postby xenon325 » 22 Mar 2013, 11:53

Hi folks, sockets noob here.

I create SteamSocket with no receive timeout, and use it like this:

Code: Select all
        received = mStreamSocket->receiveBytes(mBuffer, mBufferSize);


And it seems, that in some rare cases this line never returns. Probably, other end doesn't close connection properly.
Key word is "seems". Is it possible ?
xenon325
 
Posts: 3
Joined: 22 Mar 2013, 11:35

Re: Can Net::StreamSocket::receiveBytes "hang" ?

Postby alex » 24 Mar 2013, 22:21

xenon325 wrote:Key word is "seems". Is it possible ?

keyword is actually timeout. in blocking mode, with no timeout, of course you will hang forever if nothing arrives through the pipe.
alex
 
Posts: 1132
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Can Net::StreamSocket::receiveBytes "hang" ?

Postby xenon325 » 25 Mar 2013, 04:31

alex wrote:keyword is actually timeout. in blocking mode, with no timeout, of course you will hang forever if nothing arrives through the pipe.


Thanks, Alex. That was my thought as well. I'll try to set timeout and will report here if that was the problem.
xenon325
 
Posts: 3
Joined: 22 Mar 2013, 11:35

Re: Can Net::StreamSocket::receiveBytes "hang" ?

Postby xenon325 » 21 May 2013, 11:15

Posting just to close the thread. I've switched to another project, so can't say for sure, but most likely it fixed problem, as our app fail rate reduced by 3 times
xenon325
 
Posts: 3
Joined: 22 Mar 2013, 11:35


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest