Had a few socket questions, and could not find a definite yes or no, so apologies in advance if it is a repost:) Platform is Linux 2.6.30, C++ app. Still very new to networking, coming up to speed.
Is the socket API thread safe? For example, if I did a send from multiple threads without using a mutex or do I have to make sure of that by using my own mutexes?
Is it better to poll/select to check whether my send will block and then do a send, versus just doing a send and letting the send API internal queuing take care of the sending? If the threads are going to block anyways( if I dont use a timeout, that is), I dont really see why a poll followed by a send is required.
Are sockets zero copy by default in Linux, or is there a copy involved? Is there a size restriction if there is a copy(not in terms of the API, but in terms of the granularity)? Are there zero copy sockets if the answer is that the kernel does do a copy?
If I had to communicate between two machines, I would assume multiple sockets would utilize the bandwidth much better than a single socket. Would that a correct assumption? Whats the best way to utilize full BW between two regular Linux machines?
5.Whats your favorite tool for measuring current bandwidth usage on interfaces? This is probably just more of a preference, I looked at iptraf etc, but would like to see what others use and like most.