[lug] [OT] Threads & Socket Programming

Mr Viggy LittleViggy at alum.manhattan.edu
Thu Oct 24 17:08:57 MDT 2002


Someone else may be able to correct me, but I thought sockets in C (C++) 
were non-blocking.

Viggy

David Morris wrote:

> Sorry this is a tad OT, but:
>
> I haven't found any good web sites *or* mailing lists yet on
> this question, so I am hoping someone can point me to a good
> email list, or perhaps even answer the qustion directly.  If
> you want to help directly, please email off-list so we don't
> annoy everyone with the OT traffic.
>
> I am working on an application that uses queue of packets to
> send out over a socket.  Writing to the socket is handled by
> a thread sepperate from the main application. (FYI, language
> is C++)
>
> Everything works fine, except that if I write too many
> packets to the socket too fast, I loose data packets (never
> received by the client side).  I can solve this problem by
> putting in a sleep(1) statement, but that kind of defeats
> the purpose of having a thread to handle writing data to the
> socket from the queue.
>
> Anyone know why I would be having this problem?  Do I need
> to call some function to poll the socket and find out if
> data can be sent out yet, or if I have to wait (thought such
> blocking was handled automatically).
>
> Thanks for any input you can give on solutions, or other
> lists to ask.
>
> --David
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
> .
>




More information about the LUG mailing list