开发者

socket max number of sends?

Is there a maximum on the number of sends on a socket? My sends work upto about 480 sends after which 开发者_StackOverflowit starts returning -1

I'm using visual studio 2008 vc++ and socket programming using ACE.


No, there's no upper limit on the number of send()s you can call.

Check out the man page for send (or whichever page is suitable for your platform) and try using the perror() (example: 'perror("error sending. system said");') call to see which error is being generated.

Note that -1 is a generic return code in this case and could mean anything from "My socket closed" to "The argument you're giving me is not a valid file descriptor"; thus, it's very hard to tell what's going on without some further information.

EDIT: The above answer assumed *NIX; this was a poor assumption.

Since you're using ACE, look at the ACE::send() documentation (doxygen is here). Additionally, there should be an ACE_OS::perror("error sending. system said") call (doxygen is here) that should work similar to what I've described above.

HTH


There's no specific limit, but obviously you can't keep pumping it out at the rate of knots if the receiving side isn't consuming it as fast. There are various buffers in between, and whatever software/hardware is maintaining each will put a limit on how much they'll accept. You need to wait until the receiving side consumes some data before you continue to send. You can get an asynchronous notification of when the socket becomes writeable again... check out select or poll for details if you're using the BSD API.


As far as i know there is no such limitation. I have sends that work on and on for days sending data without any problem.

Apparently there is some other problem. Please mention more details.

Also it could be that you are sending too much data and filling up the buffer. Check that also.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜