hello, here, let's say I have a client socket ... did connect, accepted the data / sent ... and can I connect to another address, and just as if nothing had happened, start sharing with another completely host? I understand that the parameter SO_REUSEADDR does not affect this
2 answers
Namely, the option SO_REUSEADDR is used only for bind ports and has no relation to outgoing connections.
- and you can reuse the socket?) do connect () straight to many completely different endpoints many times - xperious
- Possible, but only for datagrams. When we do close (), the handle is released and the socket no longer exists. - bukkojot
- hm, and close surely to do before connect as follows? - xperious
- Can you insert the plug into another outlet while it is plugged in somewhere else? No, you can try of course. Exactly how you can write code and try to run it. - bukkojot
- Well, I am just by analogy with the sendto method, there is no need to connect anywhere, but straight from one socket you are going to different addresses - xperious
|
The SO_REUSEADDR option is used in one, extremely rare case - when two (or more programs) use the same socket at the same time . This is described in detail in Ch. 9. "Improving Performance" of the book "Creating Network Applications in a Linux Environment" (Shaun Walton).
|